Skip to content

Expose TermsTrie and SuffixTrie on IndexSpec - #10906

Merged
daxhuiberts merged 2 commits into
masterfrom
dax-ctrie-expose
Aug 14, 2026
Merged

daxhuiberts merged 2 commits into
masterfrom
dax-ctrie-expose

Conversation

@daxhuiberts

Copy link
Copy Markdown
Collaborator

Describe the changes in the pull request

  1. Current: IndexSpec's terms and suffix tries are only reachable as raw
    *mut ffi::Trie fields. Rust callers that need them — the terms scanner being
    ported next — would each have to hand-roll the null check, the pointer cast, and
    the safety argument that the spec lock is what makes the borrow sound.
  2. Change: Adds accessors on the spec lock guards: terms() on
    IndexSpecReadGuard, and terms_mut() / suffix_mut() on
    IndexSpecWriteGuard. They hand back the typed TermsTrie / SuffixTrie
    wrappers introduced in Refactor CTrieRef into TermsTrie and SuffixTrie #10886. The suffix accessor returns Option, since the
    suffix trie is only allocated once some field is declared WITHSUFFIXTRIE.
  3. Outcome: Internal-only. Trie access is now tied to the lock guard by the type
    system — shared access through the read guard, exclusive through the write one —
    so the aliasing argument lives in one place instead of at every call site. This
    unblocks porting the terms scanner without new unsafe in the caller.

Which additional issues this PR fixes

  1. N/A
  2. N/A

Main objects this PR modified

  1. IndexSpecReadGuard — new terms() returning &TermsTrie.
  2. IndexSpecWriteGuard — new terms_mut() returning &mut TermsTrie, and
    suffix_mut() returning Option<&mut SuffixTrie>.
  3. index_spec crate manifest — now depends on c_trie for the two trie wrappers.

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

@daxhuiberts
daxhuiberts requested a review from memark August 13, 2026 08:37
@daxhuiberts daxhuiberts changed the title Expose the terms and suffix tries on IndexSpec Expose TermsTrie and SuffixTrie on IndexSpec Aug 13, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88a285518f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.18%. Comparing base (1847e3f) to head (bae3cc7).

Files with missing lines Patch % Lines
src/redisearch_rs/c_wrappers/index_spec/src/lib.rs 0.00% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10906      +/-   ##
==========================================
- Coverage   83.17%   82.18%   -0.99%     
==========================================
  Files         611      635      +24     
  Lines       81136    82259    +1123     
  Branches    36374    37497    +1123     
==========================================
+ Hits        67485    67608     +123     
- Misses      13304    14304    +1000     
  Partials      347      347              
Flag Coverage Δ
flow 84.34% <ø> (-0.05%) ⬇️
unit 55.76% <0.00%> (-0.60%) ⬇️

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.

memark
memark previously approved these changes Aug 13, 2026
unsafe { Dict::from_raw(self.0.missingFieldDict) }
}

/// Returns the trie of all TEXT terms.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's sync this doc comment with the one on terms_mut function.

Base automatically changed from dax-ctrie-relocate to master August 14, 2026 12:16
@daxhuiberts
daxhuiberts dismissed memark’s stale review August 14, 2026 12:16

The base branch was changed.

Adds the accessors the terms scanner needs to reach an index's tries through
a spec guard: shared through the read guard, exclusive through the write one.
@sonarqubecloud

Copy link
Copy Markdown

@daxhuiberts

Copy link
Copy Markdown
Collaborator Author

@memark Can I get a re-✅ after rebase?

@daxhuiberts
daxhuiberts enabled auto-merge August 14, 2026 13:58
@daxhuiberts
daxhuiberts added this pull request to the merge queue Aug 14, 2026
Merged via the queue into master with commit 581f659 Aug 14, 2026
58 of 59 checks passed
@daxhuiberts
daxhuiberts deleted the dax-ctrie-expose branch August 14, 2026 15:13
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