- Notifications
You must be signed in to change notification settings - Fork 25.5k
Use inner query for equals/hashCode() in SourceConfirmedTextQuery #134451
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
Use inner query for equals/hashCode() in SourceConfirmedTextQuery #134451
Conversation
…edTextQuery We were using a valueFetcher lambda and an Analyzer as part of the equals and hashCode implementations which could easily compare as unequal for logically equal queries. We can safely just use the inner query for comparisons and hashcodes as the results of the outer query are identical to running the inner query against a shard with indexed positions.
Pinging @elastic/es-search (Team:Search) |
Hi @romseygeek, I've created a changelog YAML for you. |
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
Query sourceConfirmedPhraseQuery3 = new SourceConfirmedTextQuery(query3, sourceFetcherProvider(), Lucene.STANDARD_ANALYZER); | ||
assertNotEquals(sourceConfirmedPhraseQuery1, sourceConfirmedPhraseQuery3); | ||
| ||
Query sourceConfirmedPhraseQuery4 = new SourceConfirmedTextQuery(query1, context -> null, Lucene.STANDARD_ANALYZER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NB - these tests were specifically checking for different analyzers and value fetcher lambdas, which we no longer want to do. The Analyzer is always the same for queries against the same mapped field, so will always be identical if the inner Query is identical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is a silly little 🐛 . Good find
💔 Backport failed
You can use sqren/backport to manually backport by running |
…astic#134451) We were using a valueFetcher lambda and an Analyzer as part of the equals and hashCode implementations which could easily compare as unequal for logically equal queries. We can safely just use the inner query for comparisons and hashcodes as the results of the outer query are identical to running the inner query against a shard with indexed positions. Fixes elastic#134432
…34451) (#134456) We were using a valueFetcher lambda and an Analyzer as part of the equals and hashCode implementations which could easily compare as unequal for logically equal queries. We can safely just use the inner query for comparisons and hashcodes as the results of the outer query are identical to running the inner query against a shard with indexed positions. Fixes #134432
…34451) (#134459) * Use inner query for equals/hashCode() in SourceConfirmedTextQuery (#134451) We were using a valueFetcher lambda and an Analyzer as part of the equals and hashCode implementations which could easily compare as unequal for logically equal queries. We can safely just use the inner query for comparisons and hashcodes as the results of the outer query are identical to running the inner query against a shard with indexed positions. Fixes #134432 * Update docs/changelog/134459.yaml * Delete docs/changelog/134459.yaml
…astic#134451) (elastic#134459) * Use inner query for equals/hashCode() in SourceConfirmedTextQuery (elastic#134451) We were using a valueFetcher lambda and an Analyzer as part of the equals and hashCode implementations which could easily compare as unequal for logically equal queries. We can safely just use the inner query for comparisons and hashcodes as the results of the outer query are identical to running the inner query against a shard with indexed positions. Fixes elastic#134432 * Update docs/changelog/134459.yaml * Delete docs/changelog/134459.yaml
…astic#134451) (elastic#134459) * Use inner query for equals/hashCode() in SourceConfirmedTextQuery (elastic#134451) We were using a valueFetcher lambda and an Analyzer as part of the equals and hashCode implementations which could easily compare as unequal for logically equal queries. We can safely just use the inner query for comparisons and hashcodes as the results of the outer query are identical to running the inner query against a shard with indexed positions. Fixes elastic#134432 * Update docs/changelog/134459.yaml * Delete docs/changelog/134459.yaml
We were using a valueFetcher lambda and an Analyzer as part of the equals
and hashCode implementations which could easily compare as unequal for
logically equal queries. We can safely just use the inner query for comparisons
and hashcodes as the results of the outer query are identical to running the
inner query against a shard with indexed positions.
Fixes #134432