primer / doctocat

A Gatsby theme for building Primer documentation sites
https://primer.style/doctocat
MIT License
306 stars 54 forks source link

Improve search performance on larger sites #182

Closed BinaryMuse closed 3 years ago

BinaryMuse commented 4 years ago

While #178 helped minimize page jank while searching, the actual search process on larger sites (particularly primer/css) still takes a while — sometimes 300-1000ms depending on the query. It seems that while Fuse.js has the fastest index time, it also has the slowest search time. This is probably more ideal for a search-and-refresh flow; for real-time fuzzy-searching, we should consider an alternative solution.

I experimented with using Lunr, and while searching was indeed faster, getting good fuzzy-searching results was more difficult, as it tends to behave more like a regular full-text search. I experimented with custom queries using Index#query and adding wildcards and edit distance markers, but this increased search times to multiple seconds. More experimentation is needed.

github-actions[bot] commented 3 years ago

Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.