Skip to content

Cache regex and wildcard hitsets during warmup - #6901

Open
PSeitz wants to merge 4 commits into
quickwit-oss:mainfrom
PSeitz:hitsets-from-term-infos
Open

PSeitz wants to merge 4 commits into
quickwit-oss:mainfrom
PSeitz:hitsets-from-term-infos

Conversation

@PSeitz

@PSeitz PSeitz commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Populate the predicate cache during regex/wildcard warmup so search execution can reuse complete hitsets instead of rebuilding them with an automaton scorer. Subsequent queries can reuse the same per-split predicate hits across different filters and time ranges.

Changes

  • Automatically wrap regex and wildcard predicates in cache nodes when predicate caching is enabled.
  • Merge warmup requests sharing a resolved automaton, retaining every serialized predicate cache key.
  • Decode warmed postings from matching term infos, union document IDs in a bitset, and compress them into a HitSet.
  • Recheck the cache when constructing the scorer so queries compiled before warmup can reuse its results.
  • Keep calculated-field prefilters postings-only: their matches are not equivalent to the final predicate on multivalued fields.
  • Move query compilation and automaton compilation onto the priority-aware search thread pool.
  • Bump Tantivy and tantivy-common to upstream revision c12cc2d5.

No API or configuration changes. Scored queries and queries with predicate caching disabled retain postings-only warmup. This does not add in-flight deduplication between concurrent requests.

Verification

  • make fmt passed.
  • Five targeted tests passed across quickwit-query, quickwit-doc-mapper, and quickwit-search, covering bitset conversion, warmup merging, predicate cache keys, cache population, and caching-disabled behavior.
  • Full suite and performance benchmarks not run.
  • Compilation reports an unused Field import in query_builder.rs's test module.

@PSeitz
PSeitz requested a review from a team as a code owner October 12, 2026 11:49
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T11:58:38.079031Z 1049283 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI 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.

🟡 Changes recommended

Cache rejection causes duplicate hitset construction, and automatic caching introduces linear seeking for selective intersections.

2 open findings
What changed in this PR

This PR prepares reusable regex and wildcard hitsets during search warmup to avoid rebuilding them during execution.

Changes:

  • Adds automatic predicate caching and merges warmup cache keys.
  • Builds compressed hitsets during warmup and rechecks the cache during scorer construction.
  • Moves compilation onto the priority-aware search pool and updates Tantivy.
File Description
quickwit/​quickwit-search/​src/​leaf.rs Populates hitsets during warmup and schedules compilation.
quickwit/​quickwit-query/​src/​query_ast/​cache_node.rs Adds automatic wrapping, bitset conversion, and cache rechecks.
quickwit/​quickwit-doc-mapper/​src/​query_builder.rs Collects cache keys while preserving postings-only prefilters.
quickwit/​quickwit-doc-mapper/​src/​lib.rs Exports the automaton warmup type.
quickwit/​quickwit-doc-mapper/​src/​doc_mapper/​mod.rs Defines and merges automaton warmup requests.
quickwit/​Cargo.toml Updates Tantivy dependency revisions.
quickwit/​Cargo.lock Locks the updated Tantivy dependencies.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

&mut self,
regex_query: super::RegexQuery,
) -> Result<Option<QueryAst>, Self::Err> {
self.transform_cache_node(CacheNode::new(QueryAst::Regex(regex_query)))
Comment on lines +618 to +620
let hits = HitSet::from_bitset(bitset);
for key in cache_keys {
cache.put(split_id.clone(), key, segment_id, hits.clone());

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants