Skip to content
This repository was archived by the owner on Mar 14, 2024. It is now read-only.

Algolia

Sam Thorogood edited this page Oct 20, 2021 · 4 revisions

Algolia provides search services for our team.

Indexing

We have an 11ty collection that is called "pages" which eventually gets rendered to a helper JSON file at "pages.json" (built here).

After 11ty runs, we index based on that file as part of deploy. The script which does that uses the generated file by:

  • defining a new indexed date
  • adding that date to all entries
  • index all new pages
  • remove any items that were indexed prior to that date.

Algolia is intentionally very unstructured. It just indexes JSON objects keyed by an objectID field, which in our case, is the MD5 hash of the page's URL. Every other field is indexed somewhat generically—Algolia doesn't care whether it's a number, full-text, a Date, etc.

Search

The search side is implemented as a Web Component here. Its public keys are accessible inside that component.

Clone this wiki locally