Skip to content

fix(query): preserve query OR conditions when appending AND filters - #213

Open
chai-masalla wants to merge 3 commits into
quickwit-oss:mainfrom
chai-masalla:fix/lucene-and-or-operator-precedence
Open

fix(query): preserve query OR conditions when appending AND filters#213
chai-masalla wants to merge 3 commits into
quickwit-oss:mainfrom
chai-masalla:fix/lucene-and-or-operator-precedence

Conversation

@chai-masalla

Copy link
Copy Markdown

Summary

Fixes incorrect Lucene query behavior caused by AND having higher precedence than OR.

When filters were appended to an existing query, the original query was not wrapped in parentheses. As a result:
when we had Lucene query A OR B and filter C it was interpreted as:

A OR (B AND C)

instead of:

(A OR B) AND C

This could allow results that match the first OR condition to bypass appended filters.

Fix

Wrap the existing query in parentheses before appending a filter:

return operator ? `(${query}) ${operator} ${filter}` : `(${query}) ${filter}`;

This preserves the original query grouping and ensures appended filters apply to the complete query.

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

ℹ️ 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 thread src/utils/lucene.ts
@chai-masalla

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 47cee6cb6e

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

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