Repository navigation
fix(search): ignore accents when matching - #845
SebastienSyd wants to merge 1 commit into
Conversation
Fold terms, file stems and contents with `cooklang_find::normalize_for_search`, the same function the library scores with, so the AND filter keeps the recipes `cooklang-find` now matches without accents. Fold the same way in the static site's `search.js`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks, this works, and it covers every place search runs. I tested the PR head merged with today's Left to do before it can land
The branch merges with What I checked (with the bump)
Nit (optional): Worth knowing, not for this PR: Analysis and recommendations/changes made by Claude, posted on behalf of @LeMyst. |
Fixes #844: search treats accented letters as different letters, so
crepesmissesCrêpes.cookincook search,/api/search, the header dropdown and/search.Draft, depends on cooklang/cooklang-find#41. This uses
cooklang_find::normalize_for_search, which only exists on that branch, so CI won't compile until it's released andcooklang-findis bumped in bothCargo.tomlandcrates/core/Cargo.toml. I'll push the bump here once there's a version.Change
crates/core/src/search.rs: terms, file stems and contents are folded withcooklang_find::normalize_for_searchinstead ofto_lowercase(). Using the library's own function keeps the invariant documented onmatches_every_term: the AND filter can't drop a recipe the library matched.static/js/search.js(staticcook buildsites): the same fold in the browser, viatoLowerCase().normalize("NFD").replace(/\p{M}/gu, "").Tests
terms_match_regardless_of_accents: an unaccented term finds an accented file name, unaccented terms find accented contents (ANDed), and an accented term finds unaccented text.Run locally against the cooklang-find branch through a temporary
[patch.crates-io](not committed):cargo fmt --all --checkandcargo clippy --all-targets -- -D warnings: clean.cargo test: all search, server and API tests pass. Three tests failed, and all three are environment-specific: two pantry permission tests (the run was as root, as noted in CLAUDE.md) andupdate::tests::release_workflow_builds_this_platform(aarch64 Linux isn't in the release matrix).🤖 Generated with Claude Code