CloudCannon / pagefind

Static low-bandwidth search at scale
https://pagefind.app
MIT License
3.23k stars 99 forks source link

Pagefind needs to load index chunks based on the stemmed word #478

Open bglw opened 9 months ago

bglw commented 9 months ago

Example:

  1. Pagefind encounters the text rebase on page A, and rebaseMerge on page B.
  2. Page A's word stems to rebas, page B's word stems to rebasemerg.
  3. A chunk boundary falls in between these words. So one chunk ends with rebas and the next starts with rebasem.
  4. A user is dropped into a search for rebase without any intermediary typing.
  5. Pagefind finds the chunks needed for rebase, and loads the rebasem* chunk.
  6. Pagefind then stems to word down to rebas and searches.
  7. Pagefind does not find page A, as that chunk was not loaded.

Solution: Swap steps 5 and 6 — searching for rebase should load chunks for rebas* instead of rebase*