Skip to content

limit tag pruning to where it works - #6788

Open
trinity-1686a wants to merge 4 commits into
mainfrom
trinity.pointard/tag-prunig-invalid
Open

trinity-1686a wants to merge 4 commits into
mainfrom
trinity.pointard/tag-prunig-invalid

Conversation

@trinity-1686a

Copy link
Copy Markdown
Contributor

service:quickwit* searches for the literal quickwit* in the metastore, which it ain't gonna find, so no split matches and this query searches through zero split, despite some splits possibly containing quickwit-searcher, or even quickwit

@trinity-1686a
trinity-1686a requested a review from a team as a code owner September 9, 2026 10:16

@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

https://github.com/quickwit-oss/quickwit/blob/2edd659026ab6b39285921c86c2b6c8f17f2e631/quickwit/quickwit-docball-mapper/src/tag_pruning.rs#L258-L260
P1 Badge Treat a negated empty term set as match-all

When an accepted empty TermSet appears beneath must_not (for example, {"bool":{"must_not":[{"terms":{"field":[]}}]}}), extraction creates Or([]) and negate_ast converts it to And([]), which this branch classifies as NoMatch. An empty term set matches no documents, so its negation matches every document; both search callers now translate NoMatch into an immediate empty response, silently dropping all results. Preserve the constant through negation or classify this empty conjunction as match-all/MaybeMatch.

ℹ️ 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".

@trinity-1686a
trinity-1686a force-pushed the trinity.pointard/tag-prunig-invalid branch from f1e1535 to e23362b Compare September 9, 2026 16:17

@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: e23362b8d7

ℹ️ 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".

Comment on lines +258 to +260
// an empty And before MaybeMatch filtering matches nothing
if simplified_conditions.is_empty() {
return MaybeAst::NoMatch;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat an empty conjunction as a possible match

When an empty term set is negated (for example, an Elasticsearch bool.must_not containing terms: {"owner": []}), negate_ast turns its empty Or into an empty And. An empty conjunction represents true here, but this branch returns NoMatch, so root search prunes every split and returns zero hits instead of all documents; delete-by-query similarly skips the deletion. Return MaybeMatch (or model an explicit always-match state) for this case.

Useful? React with 👍 / 👎.

},
QueryAst::MatchAll | QueryAst::MatchNone => UnsimplifiedTagFilterAst::Uninformative,
QueryAst::MatchAll => UnsimplifiedTagFilterAst::Uninformative,
QueryAst::MatchNone => UnsimplifiedTagFilterAst::NoMatch,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Respect zero minimum_should_match before propagating NoMatch

When MatchNone is a should child of a bool query with minimum_should_match: 0, that clause is optional and the query can still match (for example, a bool whose sole child is match_none simplifies to match-all). The tag extractor ignores minimum_should_match, propagates this new NoMatch, and the root call sites consequently return an empty response without searching any split. Account for the bool's minimum before treating a should-side MatchNone as conclusive.

Useful? React with 👍 / 👎.

@trinity-1686a
trinity-1686a force-pushed the trinity.pointard/tag-prunig-invalid branch from e23362b to 647d4ab Compare September 9, 2026 18:12

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.

1 participant