Skip to content

[MOD-14883] query_eval: add QN_FUZZY evaluation tests - #10869

Merged
gdesmott merged 2 commits into
masterfrom
gd_qast_fuzzy_tests
Aug 12, 2026
Merged

gdesmott merged 2 commits into
masterfrom
gd_qast_fuzzy_tests

Conversation

@gdesmott

@gdesmott gdesmott commented Aug 11, 2026 •

Copy link
Copy Markdown
Collaborator

Describe the changes in the pull request

  1. Current: QN_FUZZY is still evaluated by the C dispatcher, and the
    query_eval integration suite has no coverage for it. Porting the evaluator
    to Rust without that coverage would leave nothing to check the port against.

  2. Change: Add query_eval integration tests for the fuzzy node evaluator,
    written and passing against the current C implementation, so they can be
    reviewed independently of any port and then act as the invariant for it.
    They cover: expansion within a Levenshtein distance ladder, the maxDist
    bound, lowercasing, the single-match collapse and its unit child weight, the
    node weight a multi-child union carries, the quick-exit union taking only the
    first child holding a document, terms without an inverted index, the field-mask
    narrowing, the expansion cap with both its warning and a negative control, the
    trie pattern-length bound, and the apiVersion-gated empty-term expansion.

    Supporting changes:

    • MockQueryNode::set_fuzzy_max_dist, so a mock fuzzy node can carry a
      distance — a zero-initialised node would only ever match the token itself.
    • A preparatory commit moving term_records and ALL_INDEXED_FIELDS out of
      the prefix tests and into the integration tests' util module, so the fuzzy
      and prefix fixtures share them instead of carrying byte-identical copies.
    • A codespell skip for the fuzzy test file, as the trie, wildcard and
      multibyte-term tests already have. The tests index terms a single edit away
      from the query token — abc is searched for while abd is indexed — which
      codespell reads as a misspelling. A file about edit distance keeps producing
      words that look like typos, because that is what it is testing.
  3. Outcome: No production code changes and no user-visible change; test-only.
    The suite becomes the safety net for the follow-up port of
    Query_EvalFuzzyNode to Rust ([MOD-14883] query_eval: evaluate QN_FUZZY in Rust #10860, stacked on this PR).

Which additional issues this PR fixes

  1. MOD-14883

Main objects this PR modified

  1. src/redisearch_rs/query_eval/tests/integration/fuzzy.rs — the new suite
  2. src/redisearch_rs/query_eval/tests/integration/util.rs — shared fixtures
  3. src/redisearch_rs/query_eval/tests/integration/prefix.rs — use the shared fixtures
  4. src/redisearch_rs/c_wrappers/query/src/mock/query_node_ref.rs — set_fuzzy_max_dist
  5. .codespell/.codespellrc — skip the fuzzy test file

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require release notes

Test-only change, no user-visible behaviour change.

@gdesmott
gdesmott force-pushed the gd_qast_fuzzy_tests branch 3 times, most recently from 97e4cd0 to 8039cc3 Compare August 11, 2026 13:43
@codecov

codecov Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.15%. Comparing base (d820ba7) to head (05534d1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10869      +/-   ##
==========================================
- Coverage   83.08%   82.15%   -0.93%     
==========================================
  Files         608      632      +24     
  Lines       80936    82051    +1115     
  Branches    36114    37229    +1115     
==========================================
+ Hits        67247    67412     +165     
- Misses      13346    14296     +950     
  Partials      343      343              
Flag Coverage Δ
flow 84.31% <ø> (-0.05%) ⬇️
unit 55.64% <100.00%> (-0.55%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Move `term_records` and `ALL_INDEXED_FIELDS` out of the prefix tests and into
the integration tests' `util` module, so upcoming fixtures can use them instead
of carrying byte-identical copies.
Add `query_eval` integration tests covering the fuzzy node evaluator ahead of
porting it to Rust: expansion within a Levenshtein distance ladder, the
maxDist bound, lowercasing, the single-match collapse and its unit child
weight, the node weight a multi-child union carries, the quick-exit union
taking only the first child holding a document, terms without an inverted
index, the field-mask narrowing, the expansion cap with both its warning and
a negative control, the trie pattern-length bound, and the apiVersion-gated
empty-term expansion.

Add `MockQueryNode::set_fuzzy_max_dist` so a mock fuzzy node can carry a
distance; a zero-initialised node would only ever match the token itself.

codespell skips the fuzzy test file, as the trie, wildcard and multibyte-term
tests already are. The tests index terms a single edit away from the query
token, so `abc` is searched for while `abd` is indexed — which codespell reads
as a misspelling of "and" or "bad". A file about edit distance will keep
producing words that look like typos, because that is what it is testing.
@gdesmott
gdesmott force-pushed the gd_qast_fuzzy_tests branch from 8039cc3 to 05534d1 Compare August 12, 2026 07:49
@sonarqubecloud

Copy link
Copy Markdown

@gdesmott
gdesmott added this pull request to the merge queue Aug 12, 2026
Merged via the queue into master with commit a725b96 Aug 12, 2026
53 checks passed
@gdesmott
gdesmott deleted the gd_qast_fuzzy_tests branch August 12, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants