Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Algolia DocSearch to our site #504

Closed
hammer opened this issue Mar 18, 2021 · 7 comments · Fixed by #668
Closed

Add Algolia DocSearch to our site #504

hammer opened this issue Mar 18, 2021 · 7 comments · Fixed by #668
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@hammer
Copy link
Contributor

hammer commented Mar 18, 2021

https://docsearch.algolia.com/

I've already applied, they're going to send me a JS snippet to put on our site to enable indexing. We should get a nice typeahead for our search box once this goes live.

@hammer hammer added the documentation Improvements or additions to documentation label Mar 18, 2021
@hammer hammer self-assigned this Mar 18, 2021
@jeromekelleher
Copy link
Collaborator

Nice, looking forward to seeing the results.

@hammer
Copy link
Contributor Author

hammer commented Mar 18, 2021

For future reference here are the docs on getting it set up https://docsearch.algolia.com/docs/dropdown.

@hammer
Copy link
Contributor Author

hammer commented Apr 15, 2021

DocSearch is ready! I will see if I can do the integration myself...

@hammer
Copy link
Contributor Author

hammer commented Sep 13, 2021

I got a note from Algolia on September 9 saying that they're going to stop crawling our site on September 23 if we don't get search implemented before then.

I took a look at the integration and it's non-trivial. There's some discussion on search, Algolia, Sphinx, and the RTD theme:

Unfortunately I don't see any discussion specific to our theme https://github.com/executablebooks/sphinx-book-theme.

The Algolia email:

Copy the following CSS/JS snippets and add them to your page

<!-- 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: '<REDACTED>',
indexName: 'sgkit',
inputSelector: '### REPLACE ME ####',
debug: false // Set debug to true if you want to inspect the dropdown
});
</script>

@hammer
Copy link
Contributor Author

hammer commented Sep 14, 2021

I spent a bit of time yesterday and today figuring this out and I have hit the limits of my frontend knowledge. I filed executablebooks/sphinx-book-theme#394 upstream, so hopefully some kind soul will reply there.

@hammer
Copy link
Contributor Author

hammer commented Sep 14, 2021

Lol turns out that worked, I just needed to clear some cache. If y'all think a slightly ugly and suboptimal typeahead is a good idea, let's try it out. If not, we can put this on hold for a bit until we get some styling hints.

In addition to styling, I also think we'll want to exclude the index from being crawled and searched, since it generates duplicate entries in the typeahead.

@hammer
Copy link
Contributor Author

hammer commented Sep 14, 2021

To customize the crawling process, we can modify https://github.com/algolia/docsearch-configs/blob/master/configs/sgkit.json. Documentation for this file is at https://docsearch.algolia.com/docs/config-file/.

In particular we may want to use page_rank to rank some content higher, and facetFilters to only search the most recent released version (cf. #669).

@hammer hammer mentioned this issue Sep 20, 2021
3 tasks
@mergify mergify bot closed this as completed in #668 Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants