Skip to content

Correct XCombinedFieldQuery equals and hashCode #75402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 19, 2021

Conversation

jtibshirani
Copy link
Contributor

Previously the equals and hashCode methods only compared the query terms. This
meant that queries on different fields, or with different field weights, were
considered equal.

During boolean query rewrites, duplicate clauses are removed. So because equals/
hashCode was incorrect, rewrites could accidentally drop combined_fields query
clauses.

Fixes #75223.

Previously the equals and hashCode methods only compared the query terms. This
meant that queries on different fields, or with different field weights, were
considered equal.

During boolean query rewrites, duplicate clauses are removed. So because equals/
hashCode was incorrect, rewrites could accidentally drop combined_fields query
clauses.
@jtibshirani jtibshirani added >bug :Search/Search Search-related issues that do not fall into other categories v8.0.0 v7.14.0 v7.15.0 labels Jul 15, 2021
@jtibshirani
Copy link
Contributor Author

jtibshirani commented Jul 16, 2021

Corresponding Lucene issue: https://issues.apache.org/jira/browse/LUCENE-10026. I copied over the fix that we merged in Lucene.

@jtibshirani jtibshirani marked this pull request as ready for review July 16, 2021 20:28
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Jul 16, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@jtibshirani jtibshirani requested a review from cbuescher July 16, 2021 20:28
Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

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

LGTM.
Out of interest: I saw the corresponding fix went into Lucene 8.10 so far, any plans on backportign those to 8.9 or not? Only asking since eventually we'll want to remove our version of the query and it would be good to know which Lucene version is equivalent to the current state.

@jtibshirani
Copy link
Contributor Author

@cbuescher Lucene 8.9.0 was actually already released, and I don't think it's common to do patch releases. If 8.9.1 does end up being planned, I will make sure to backport it.

@jtibshirani jtibshirani merged commit a40ca70 into elastic:master Jul 19, 2021
@jtibshirani jtibshirani deleted the combined-fields branch July 19, 2021 16:47
jtibshirani added a commit that referenced this pull request Jul 19, 2021
Previously the equals and hashCode methods only compared the query terms. This
meant that queries on different fields, or with different field weights, were
considered equal.

During boolean query rewrites, duplicate clauses are removed. So because equals/
hashCode was incorrect, rewrites could accidentally drop combined_fields query
clauses.
jtibshirani added a commit that referenced this pull request Jul 19, 2021
Previously the equals and hashCode methods only compared the query terms. This
meant that queries on different fields, or with different field weights, were
considered equal.

During boolean query rewrites, duplicate clauses are removed. So because equals/
hashCode was incorrect, rewrites could accidentally drop combined_fields query
clauses.
ywangd pushed a commit to ywangd/elasticsearch that referenced this pull request Jul 30, 2021
Previously the equals and hashCode methods only compared the query terms. This
meant that queries on different fields, or with different field weights, were
considered equal.

During boolean query rewrites, duplicate clauses are removed. So because equals/
hashCode was incorrect, rewrites could accidentally drop combined_fields query
clauses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v7.14.0 v7.15.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Combined_fields query not behaving correctly inside bool query under certain circumstances
4 participants