feat: Combine regexes targeting same fields#68
Merged
Conversation
Signed-off-by: Darkheir <raphael.cohen@sekoia.io>
There was a problem hiding this comment.
Pull request overview
This PR optimizes search warmup for regex-based queries by coalescing multiple regex patterns that target the same (field, json path) into a single multi-pattern automaton, reducing redundant term-dictionary traversals and making combined-regex construction a strict failure point when limits are hit.
Changes:
- Coalesce regex automatons per field+path into a single
Automaton::Regex(..., Vec<String>)and deduplicate/sort patterns before warmup. - Update warmup logic to build a combined regex automaton via
tantivy_fst::Regex::from_patterns(...)and fail warmup if the combined regex cannot be built. - Add tests covering regex coalescing behavior and warmup failure on unbuildable combined regex; bump patched
tantivy-fstrevision.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| quickwit/quickwit-search/src/leaf.rs | Build a combined regex automaton from multiple patterns during warmup and add a regression test for failure behavior. |
| quickwit/quickwit-doc-mapper/src/query_builder.rs | Coalesce regex automatons by (field, path) and add tests for field-limit behavior and coalescing semantics. |
| quickwit/quickwit-doc-mapper/src/doc_mapper/mod.rs | Update Automaton::Regex to hold multiple patterns (Vec<String>) and adjust tests accordingly. |
| quickwit/Cargo.toml | Update the patched tantivy-fst git revision. |
| quickwit/Cargo.lock | Lockfile update corresponding to the patched tantivy-fst revision bump. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
e62f207 to
37bb03c
Compare
Signed-off-by: Darkheir <raphael.cohen@sekoia.io>
rdettai-sk
reviewed
Jun 22, 2026
Signed-off-by: Darkheir <raphael.cohen@sekoia.io>
rdettai-sk
reviewed
Jun 22, 2026
rdettai-sk
approved these changes
Jun 22, 2026
Signed-off-by: Darkheir <raphael.cohen@sekoia.io>
2d10a0a to
8884e1d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Combine regexes targeting same field and let the regex creation fail if the limit is reached.
How was this PR tested?
Describe how you tested this PR.