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 UI #22

Closed
wants to merge 15 commits into from
Closed

Conversation

jonathansick
Copy link
Contributor

The purpose of this work is to begin adding the Algolia InstantSearch UI into the Learn site to provide a browseable, filterable, and searchable listing of content.

These pages will be the browsing/search pages for specific categories of
content.

Also established links to these pages from our nav components (footer
and categoryHero).
This provides resets and base styles for the instantsearch UI
components.
This search client includes our Algolia project ID and read-only API
key. Both of these are safe and in fact intended to be used client-side.

Individual search UIs can import and use this client with the
InstantSearch React component.
Breakpoints can't be set through CSS custom properties. Instead, we set
them in JS and use string interpolation in styled components to share
reusable breakpoint dimensions.
This is the core infrastructure for styling the Algolia hit components
for tutorials (the search result cards).

In the hits.js module we're extending the built-in Algolia hit component
so that we can pass props to the hit components in the future (e.g. to
control information display).

In the tutorialHit.js module we're setting up the result card's display
specifically for tutorial results. Right now we're just showing the
title and a snippet extract from the search.
The categories match the existing learn site and correspond to fields in
the Algolia data model.
We implement a custom version of the Algolia instantsearch
RefinementList in order to get control over styling.
This ensures that the counts next to each keyword in the RefinementsList
(and other faceting widgets) correspond to the number of tutorials (base
URLs) rather than the number of documents in the Algolia DB.
If there are too many facets in a keyword list, the user can either hit
the show more button to show additional facets, or search for the facet.

The default is to order facets by their popularity, which especially
makes sense in the context of showing results from a search term---you
want to use these keywords to filter further and it makes sense to be
able to zero in on the most popular keyword (or exclude it).

This work is using the built-in instantsearch styling so far.
This widget makes it easy to see and dismiss what filters are active.
The custom CurrentRefinement component includes a function to translate
database attributes into presentational labels (e.g.
"astropy_package_keywords" to "Astropy package")
The goal is to match the appearance of the existing tutorial card.
@jonathansick jonathansick mentioned this pull request Aug 2, 2021
@jonathansick
Copy link
Contributor Author

Replaced by #25 since we're now looking to put results on the homepage, and combine search results from all content types.

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

Successfully merging this pull request may close these issues.

1 participant