Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Update ESLint config (refs eslint/eslint.github.io#475) #440

Merged
merged 4 commits into from
Jun 14, 2018

Conversation

platinumazure
Copy link
Contributor

@platinumazure platinumazure commented Jun 6, 2018

Refs eslint/archive-website#475.

Pull request motivation(s)

Change ESLint config so that by default, it will index only latest documentation (and not historical documentation from older versions).

What is the current behaviour?

Currently, the docsearch autocomplete (on our ESLint website repo) assumes that we should be faceting on "version:3.0.0" content. However, we actually have no real need to index old versions of content at this point (although this could change later). As a result, some search results are broken.

What is the expected behaviour?

Hoping to fix the search results by structuring things a little more sensibly 😄

NB2: Any other feedback / questions?

This is my first time working on docsearch, so I would be grateful for any feedback or suggestions.

If this is something that the docsearch/algolia maintainers should be doing exclusively, please close this and forgive my wasting your time.

Also, could we hold off on merging right away? I need to create a PR on our site and link it over here. Once the ESLint folks and any generous docsearch folks take a look and make sure all is well, then we can merge both this PR and the ESLint site PR and hopefully be good to go for the next crawl.

@platinumazure platinumazure changed the title Update ESLint config Update ESLint config (refs eslint/eslint.github.io#475) Jun 6, 2018
@platinumazure
Copy link
Contributor Author

platinumazure commented Jun 6, 2018

Also: Completely out of curiosity, is there any way to "preview" this? 😅

EDIT: Never mind, I think I see the answer-- I need to install the scraper and then use the playground utility. I'll make sure to test carefully! 😄

@s-pace
Copy link
Contributor

s-pace commented Jun 7, 2018

👋 @platinumazure

Thank you for the PR and for the details.

EDIT: Never mind, I think I see the answer-- I need to install the scraper and then use the playground utility. I'll make sure to test carefully! 😄

It is indeed the good way in order to understand what is going under the hood.


I have updated your PR in order to makes it work with our tool. Feel free to review if you need further explanations.

I have created a temporary index in order to let you try it out. You can also find it here ad a one page showcase

This new index is only crawling the latest version as requested.

The integration will follow these steps (credentials apiKey & indexName will change after the merge, they will be the current live ones):

<!-- at the end of the HEAD -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />

<!-- at the end of the BODY -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<script type="text/javascript"> docsearch({
  apiKey: '98dae3251234b5fa24ac3bfcb56b1a8d',
  indexName: 'eslint_demo_475',
  inputSelector: '### REPLACE ME ####',
  algoliaOptions: { 'facetFilters': ["tags:$TAGS", "area:$AREA"] },
  debug: false // Set debug to true if you want to inspect the dropdown
});
</script>
  • Add a search input in your page if you don't have any yet. Then update the inputSelector value in JS snippet to a CSS selector that targets your search input field.

  • Replace $TAGS with the tags you want to search on.
    The list of possible tags is hardcoded in the config.
    So as of today you have: blog, docs

  • Replace $AREA with the area you want to search on.
    The list of possible area is hardcoded in the config.
    So as of today you have: developer-guide, maintainer-guide, rules, user-guide

    For example if you want to refine the search to the tags "blog" and the area "developer-guide" just specify:

 'facetFilters': ["tags:blog", "area:developer-guide"]

@platinumazure
Copy link
Contributor Author

platinumazure commented Jun 7, 2018

Thanks @s-pace, greatly appreciate your time in helping to correct my PR as well as provide a demo index.

I tried the showcase and one of our known search issues is resolved, so I'm more confident that this is what we need.

Regarding the facet information:

  • If I want to search on everything, do I need to pass algoliaOptions at all?
  • If I want to search on multiple tags or areas, how would I do that? (I don't need to do so in this case, but that could change in future.)

Also: Could I ask you to take a quick look at eslint/archive-website#481 and make sure that looks sensible? This is the client-side change.

@s-pace
Copy link
Contributor

s-pace commented Jun 8, 2018

👋 @platinumazure

You are welcome!

If I want to search on everything, do I need to pass algoliaOptions at all?

If you don't specify any facets, the scope of the search will be global. So yes you can remove the following line:

algoliaOptions: { 'facetFilters': ["tags:$TAGS", "area:$AREA"] },

If I want to search on multiple tags or areas, how would I do that? (I don't need to do so in this case, but that could change in future.)

Good to foresee your need. You can use some combinations of different conditions. See the dedicated article on the algolia doc

eslint/archive-website#481 commented. Please ping us when we need to merge the configuration fromeslint_demo_475 into eslint

@platinumazure
Copy link
Contributor Author

Thanks again @s-pace!

I'd like to try the eslint_demo_475 index locally (using the "playground" on a clone of the scraper repo) this weekend. Once I've done that and everything looks good, I'll ask that this PR be merged and then merge the eslint/eslint.github.io PR as soon as I see this one merged.

In the meanwhile, please continue to hold off on merging. Thanks!

@s-pace s-pace added the on hold label Jun 8, 2018
@platinumazure
Copy link
Contributor Author

Hi @s-pace, I discovered a minor inconsistency in the new index (well, either that or an inconsistency in the configuration available to the showcase).

Use case: I tried searching for the word "released", I expected to see blog posts on eslint.org announcing new software releases.

  • Current site/index: Release announcements come back with the newest first. This seems sensible.
  • Showcase: Release announcements come back with the oldest first.

Looking at the eslint.json file, I'm actually not seeing any configuration about how to order certain types of results. The only thing I can think of is that on the current site, we do crawl the blog page (see https://eslint.org/blog) and the releases would appear most recent first, so maybe that's the order they go into the index normally. What I can't tell is if the new configuration in this PR is imposing a different order, or if this was just due to a limitation in the showcase.

I'm sorry for asking so many questions. I'm okay with things not being exactly perfect on the first go-around, but I want to at least make sure I'm learning what I need to learn for DocSearch configuration so I can make little tweaks later. Thanks so much for your patience with me as I try to figure this out!

@s-pace
Copy link
Contributor

s-pace commented Jun 11, 2018

👋 @platinumazure

No problem.

The consistency between these indices isn't guaranteed. The current one isn't chronologically ranked nor the new one is. Is this something you want to do? If so, we will need a way to extract the date of the article from the webpage. This could be a meta named like docsearch:date

Let me know if I get you well and that it is something you want to achieve: ordered result by date

The demo isn't specific so far.

@platinumazure
Copy link
Contributor Author

Hi @s-pace, thanks for your explanation.

At this point, I'm not going to worry about the chronological aspects. Let's just merge this in 😄 I'll deal with any problems that come up later.

I'll be waiting for this to be merged, and then I can merge the eslint/eslint.github.io pull request.

Thanks again!

@s-pace s-pace merged commit c78395a into algolia:master Jun 14, 2018
s-pace pushed a commit that referenced this pull request Jun 14, 2018
platinumazure added a commit to eslint/archive-website that referenced this pull request Jun 14, 2018
@platinumazure platinumazure deleted the patch-1 branch June 14, 2018 14:34
@platinumazure
Copy link
Contributor Author

Hi @s-pace, thanks for merging this.

Just one more question: Is there a status page or similar for when the official scraper has run and built indexes? Just wondering in case I need to track when the scraper is run or if I didn't think the index was being built successfully. I've done some Googling but haven't found such a page yet-- maybe I'm using the wrong terms. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants