Improve short-query precision in Algolia search#741
Improve short-query precision in Algolia search#741Flamki wants to merge 3 commits intoprecice:masterfrom
Conversation
|
Hi @Flamki, thanks for submitting the PR! I just have one question about the scope of the fix. The Since Was this intentional to keep the fix narrow? (Also can you attach the screenshot of your solution working locally) Also can you see my PR #744 |
|
Thanks for the careful review, great catch. You were right: the earlier helper was too narrow for multi-word input. I updated the PR so short tokens are handled even when part of a longer query (for example Follow-up changes in this PR:
This keeps the scope narrow (only short-token queries), avoids global index/config changes, and keeps XML search behavior for normal XML queries. Validation:
Local screenshots:
|
d33a06c to
6629092
Compare
|
Hey @Flamki , thanks for iterating on this! One thing I wanted to point out about the updated approach:
This means the conditional check via So the helper function adds ~20 lines of logic that doesn't change any search behavior compared to the simpler unconditional approach. I think the minimal 2-line version keeps things cleaner and easier to maintain. Happy to discuss if I'm missing something though! 🙂 |


Summary
Improve search precision for short queries (for example
gsoc) without weakening XML reference search globally.Problem
Short queries can produce false positives from XML/code snippets due to typo + prefix matching.
Change
In both Algolia client entry points (
_includes/algolia.html,js/algolia-search.js):3-5), including multi-word queries.minWordSizefor1Typo = 5minWordSizefor2Typos = 94/8).Why this approach
sockets).gsoc projects).Validation
pre-commit run --files _includes/algolia.html js/algolia-search.jsdocker run --rm -v "${PWD}:/srv/jekyll" -w /srv/jekyll jekyll/jekyll:4 bash -lc "bundle install && bundle exec jekyll build"Closes #733