mirror of
https://github.com/bitbaum/listkit.git
synced 2026-12-03 16:27:38 +01:00
v0.1 matched the whole query as one substring and sorted matches like any other row. Three ways that failed people: - word order: "bike sell" did not find "Sell my old bike"; - accents: "zurich" did not find "Zürich", "strasse" not "Straße"; - ranking: a title hit and a hit deep in a description sorted alike. Now (src/search.ts): - searchMatches: every folded word must appear in some field; - normalise: NFKD, marks stripped, ß→ss, casefold, collapse spaces; - searchScore: field position (most important first) × match quality (whole field > field start > word start > inside), plus a phrase bonus; - applyQuery ranks by score while a search is active and the sort is the default; ties keep the default order; a chosen sort wins; `?sort=relevance` asks explicitly; `search.rank: false` opts out; - searchTerms(q) so SQL builders AND one likeContains per word. Filtering only widens (no previous match is lost), so this is a minor bump. 9 new tests; verify green. Claude-Session: https://claude.ai/code/session_01TAtbutb1k6VKYMPLVfSt92 Co-authored-by: Claude <noreply@anthropic.com>