Repository navigation
Use inner query for equals/hashCode() in SourceConfirmedTextQuery - #134451
Merged
elasticsearchmachine merged 3 commits intoSep 10, 2025
Merged
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.
Collaborator
|
Pinging @elastic/es-search (Team:Search) |
Collaborator
|
Hi @romseygeek, I've created a changelog YAML for you. |
Collaborator
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
romseygeek
commented
Sep 10, 2025
| Query sourceConfirmedPhraseQuery3 = new SourceConfirmedTextQuery(query3, sourceFetcherProvider(), Lucene.STANDARD_ANALYZER); | ||
| assertNotEquals(sourceConfirmedPhraseQuery1, sourceConfirmedPhraseQuery3); | ||
|
|
||
| Query sourceConfirmedPhraseQuery4 = new SourceConfirmedTextQuery(query1, context -> null, Lucene.STANDARD_ANALYZER); |
Contributor
Author
There was a problem hiding this comment.
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.
benwtrent
approved these changes
Sep 10, 2025
benwtrent
left a comment
Contributor
There was a problem hiding this comment.
Yeah, this is a silly little 🐛 . Good find
Collaborator
💔 Backport failed
You can use sqren/backport to manually backport by running |
romseygeek
added a commit
to romseygeek/elasticsearch
that referenced
this pull request
Sep 10, 2025
…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
elasticsearchmachine
pushed a commit
that referenced
this pull request
Sep 10, 2025
…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
elasticsearchmachine
pushed a commit
that referenced
this pull request
Sep 10, 2025
…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
sarog
pushed a commit
to portsbuild/elasticsearch
that referenced
this pull request
Sep 11, 2025
…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
sarog
pushed a commit
to portsbuild/elasticsearch
that referenced
this pull request
Sep 19, 2025
…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
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.
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