blockly-samples
blockly-samples copied to clipboard
fix: toolbox search final trigram
The basics
- [x] I validated my changes
The details
Resolves
Fixes https://github.com/RaspberryPiFoundation/blockly-samples/issues/2645
Proposed Changes
- Include the final trigram when generating search tokens to prevent partial matches on long queries.
- Add a regression test covering the “conso” false positive case.
- Expand BlockSearcher tests for short/empty input, underscore normalization, dropdown alt text indexing, and disambiguation between similar blocks.
Reason for Changes
- Prevent toolbox search from returning false positives for queries longer than three characters and improve overall search accuracy.
Test Coverage
npm test -- --runInBand(blockly-scripts test)
Documentation
- No documentation updates needed.
Additional Information
- Additional tests define temporary blocks/dropdowns to exercise edge cases; no user-facing behavior changes beyond correcting search results.
Thank you for identifying and reporting this issue and sending a fix! I really appreciate the improved tests as well. I just had two minor questions, and if you could run npm run format and commit the results of that to make the linter happy I think we should be good to merge this.