cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Unswizzle Docusaurus SearchComponent

Open pokey opened this issue 3 years ago • 0 comments

We swizzled the Docusaurus SearchComponent in https://github.com/cursorless-dev/cursorless/pull/915 so that we could implement custom contextual optional facet filters in order to prefer user docs or contributor docs, depending whether the user is currently looking at user or contributor docs.

The search component is swizzled into the SearchBar directory. To see how it has changed, compare the current version with the original version.

Unforunately, this component uses lots of internal details, so could break when we upgrade Docusaurus. We have therefore pinned Docusaurus

Once Docusaurus supports custom contextual optional facet filters, we should un-swizzle this component and un-pin Docusaurus. This page tracks the progress of that feature request.

Update:

On Docusaurus Discord, I got the following response

Hey, do you mean results would be preferred or restricted to the current context?

If restricted, you are on the right path as you can only retrieve results for the current lvl0 with filters

If preferred/re-ranked, we have some documentation about the custom ranking criteria here: https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/ otherwise you can apply some frontend sorting and re-order the results, you can do so by using the transformItems method: https://docsearch.algolia.com/docs/api#transformitems

Seems promising; will need to see if the items returned have enough info for us to do the re-ranking we want

pokey avatar Sep 06 '22 14:09 pokey