Repository navigation
feat(search): match multi-word queries as an AND of terms in global search - #1899
Conversation
…earch Match space-separated queries in global search as an AND of terms after checking for an exact contiguous phrase, allowing users to filter global search results by adding keywords or file extensions. Reuse text_matches_words across filter_name_matches and fuzzy_score_normalized with zero heap allocation per candidate item.
Review fixesPushed
ValidationScope: global-search scoring and its shared literal-name filter caller. The separate path/folder matcher, indexing/lifecycle implementation, preferences, dependencies, and build infrastructure are unchanged, so validation remained targeted rather than running full local suites.
A private All required CI checks are green for |
Compare character-aligned UTF-8 suffixes directly instead of walking cloned character iterators for each possible edit. Preserve Unicode insertion, deletion, substitution, and transposition behavior without adding allocations or query-cache complexity.
Performance follow-upPushed MeasurementsCompared with Filename-term matching used 8.5–14.7% less CPU across eight queries. Examples, milliseconds per 200,000 candidates:
Whole global-query scoring was workload-sensitive: some improved, others were effectively unchanged; no general UI-latency improvement is claimed. All benchmark hit counts and score checksums matched, as did 1,863,225 generated ASCII/Unicode word pairs. A single-pass filename/path prototype had inconsistent benefits and was discarded. Scratch command: Published performance commit validation
The bounded selection covers global/recursive scoring, shared default listing filters, Unicode/typo rules, ranking, and incremental/parallel scoring. No GUI behavior changed, so no scenarios were rewritten for the optimization. CI blocker and unpushed dependency proposalAt A minimal compatible update was prepared with
The dependency proposal was not committed or pushed because those unrelated validation blockers remain. It is preserved at |
|
Per the owner’s request, the zstd dependency advisories are left for a separate fix. No dependency updates or associated baseline-test cleanup were committed or pushed; the interrupted diagnostic run was stopped, and the checkout is clean at All other required CI checks pass. The remaining Dependency and spelling policy failure is the existing RustSec audit blocker documented above; it is not being reported as passed. The manual-only CI QA job remains skipped. |
Review and cleanup
Review against the description and #1889. All claims confirmed:
Tests audited: Fixes pushed
Validation
CI at |
Description
Global search (Ctrl+K) now matches space-separated terms across filenames and paths, so
duck txtfindsducks_in_the_pool.txtandsubfolder txtfindsnested/subfolder/notes.txt. It reuses the folder filter's allocation-free substring and typo matcher from #1768. Typo checks compare character-aligned UTF-8 suffixes directly instead of repeatedly decoding them.Match tiers keep contiguous filename hits ahead of contiguous path hits, then all-in-filename term matches, path-only term matches, and the existing fuzzy fallback. Path length, depth, and fuzzy bonuses cannot reverse those tiers. Fuzzy fallback is preserved, so multi-word queries are not a strict filter.
Visual evidence
N/A. Matching and ranking change only; the search palette layout is unchanged.
How to test
duck txt notes.md,ducks_in_the_pool.txt,duck.md, andnested/subfolder/notes.txt.duck txt.subfolder txt. Repeat with matching files under long or deeply nested paths.Expected result:
duck txtfinds the phrase match before the scattered filename match.subfolder txtfindsnotes.txt. Stronger match tiers remain first regardless of path length or depth; any fuzzy-only results rank below term matches.Related issue
Closes #1889