Page MenuHomePhabricator

Consider adding search to the Codex docs site
Open, LowPublic3 Estimated Story PointsSpike

Description

As a user of Codex, I want to be able to quickly find the page I want to go to

As a user of Codex, I want the option of searching for something instead of reading through the navigation menus

Search is critical for a documentation website, and we've already identified issues with not having it (see discussion on the component groups task). Search will be an important complement to navigation menus.

VitePress integrates with Algolia for site search. While the documentation has been removed from the latest VitePress docs, the VitePress site still uses it.

Acceptance criteria

  • Determine if Algolia will still be supported moving forward
  • If so, get the free version and implement on the docs site as a test run
  • If needed, evaluate if we need a paid plan (they have open source/non-profit plans)
  • If simple Algolia integration is not possible or desirable, evaluate whether we want to roll our own search using Lunr.js instead.

Event Timeline

@egardner suggested we consider using Lunr, which is FOSS. Here's an example: https://www.getty.edu/publications/romanmosaics/

If Algolia integration is free and straightforward, then that's probably a good solution. But in the past I've had good luck with Lunr for client-side search in these kinds of sites. Since the content is all static, we can generate a search index at build time (most likely a big JSON file) and then feed it into Lunr when the user triggers the search. You can even weight different fields (setting matches in titles to be worth more than matches in body text, etc) to tune the results.

Would be cool if we could actually use Typeahead with a different back-end for this purpose.

This code is in Ruby and specific to the Middleman site generator, but it would be pretty simple to do something similar in Node that loops through all the pages in the docs site and builds a data structure, then writes it to a file on disk in JSON format.

ldelench_wmf moved this task from Inbox to Needs Refinement on the Design-System-Team board.
egardner changed the subtype of this task from "Task" to "Spike".Sep 28 2022, 8:24 PM
egardner updated the task description. (Show Details)
ldelench_wmf lowered the priority of this task from High to Low.Oct 24 2022, 4:13 PM