Skip to content

[MOD-19077] Share the pattern-filtered trie iterator between triemap_ffi and tag_index - #11618

Merged
gdesmott merged 2 commits into
masterfrom
gdesmott-trie-pattern-iter
Oct 5, 2026
Merged

gdesmott merged 2 commits into
masterfrom
gdesmott-trie-pattern-iter

Conversation

@gdesmott

@gdesmott gdesmott commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Describe the changes in the pull request

  1. Current: triemap_ffi and tag_index each carry their own copy of the same runtime-selected prefix/contains/suffix/wildcard lending iterator over a TrieMap, and Rust code that wants a pattern walk over a C-owned trie has to go through the TrieMapIterator C ABI.
  2. Change: that iterator now lives once in trie_rs as PatternLendingIter, built with TrieMap::pattern_lending_iter(pattern, PatternMode). Both crates use it; tag_index re-exports PatternMode as IterMode, so its API is unchanged.
  3. Outcome: Internal-only, no behavior change. It lets the Rust tag-node evaluator walk tag values directly instead of round-tripping through TrieMap_IterateWithFilter / TrieMapIterator_*.

This will allow #11206 to use this code without depending on the ffi crate.

Main objects this PR modified

  1. trie_rs::iter::PatternLendingIter / PatternMode — new shared iterator; suffix mode now carries its pattern instead of a boxed closure.
  2. triemap_ffi TrieMapIterator — wraps the shared iterator; its private copy and the rqe_wildcard dependency are gone.
  3. tag_index::TagIndexIterator — wraps the shared iterator; its private copy is gone. The contains variant is now boxed here too, as it already was in triemap_ffi.

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

@gdesmott
gdesmott force-pushed the gdesmott-trie-pattern-iter branch from e4aa354 to 75d8831 Compare September 29, 2026 12:31
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.03922% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.53%. Comparing base (c8f9d94) to head (613c08c).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...redisearch_rs/c_entrypoint/triemap_ffi/src/iter.rs 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11618      +/-   ##
==========================================
- Coverage   84.24%   83.53%   -0.72%     
==========================================
  Files         640      665      +25     
  Lines       85448    86566    +1118     
  Branches    39264    40355    +1091     
==========================================
+ Hits        71988    72311     +323     
- Misses      13094    13881     +787     
- Partials      366      374       +8     
Flag Coverage Δ
flow 84.62% <ø> (-0.02%) ⬇️
unit 58.96% <98.03%> (-0.42%) ⬇️

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.

@gdesmott
gdesmott force-pushed the gdesmott-trie-pattern-iter branch from 75d8831 to 8bdab5b Compare September 29, 2026 13:16
@gdesmott gdesmott changed the title Share the pattern-filtered trie iterator between triemap_ffi and tag_index [MOD-19077] Share the pattern-filtered trie iterator between triemap_ffi and tag_index Sep 29, 2026
@gdesmott
gdesmott force-pushed the gdesmott-trie-pattern-iter branch from 8bdab5b to 8e7f36e Compare September 30, 2026 09:48
Move the runtime-selected prefix/contains/suffix/wildcard lending iterator
out of triemap_ffi into trie_rs as PatternLendingIter, built through
TrieMap::pattern_lending_iter, so Rust callers can walk a trie by pattern
without going through the TrieMapIterator C ABI.

The suffix filter now carries its pattern instead of a boxed closure.
Replace the crate's own copy of the mode-dispatching lending iterator with
trie_rs's PatternLendingIter, and re-export PatternMode as IterMode so the
crate's API is unchanged.
@gdesmott
gdesmott force-pushed the gdesmott-trie-pattern-iter branch from 8e7f36e to 613c08c Compare September 30, 2026 12:29
@sonarqubecloud

Copy link
Copy Markdown

@gdesmott
gdesmott added this pull request to the merge queue Oct 5, 2026
Merged via the queue into master with commit 279dc95 Oct 5, 2026
61 checks passed
@gdesmott
gdesmott deleted the gdesmott-trie-pattern-iter branch October 5, 2026 12:31
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