-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Apply boost only once for distance_feature query #63767
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,7 +112,8 @@ protected Query doToQuery(QueryShardContext context) throws IOException { | |
| if (fieldType == null) { | ||
| return Queries.newMatchNoDocsQuery("Can't run [" + NAME + "] query on unmapped fields!"); | ||
| } | ||
| return fieldType.distanceFeatureQuery(origin.origin(), pivot, boost, context); | ||
| // As we already apply boost in AbstractQueryBuilder::toQuery, we always passing a boost of 1.0 to distanceFeatureQuery | ||
| return fieldType.distanceFeatureQuery(origin.origin(), pivot, 1.0f, context); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we fix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, I or Nik will do that. |
||
| } | ||
|
|
||
| String fieldName() { | ||
|
|
||
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.
It would be nice to rely on unit tests like
DistanceFeatureQueryBuilderTestsor a REST test instead of an integration test. We try to avoid newESIntegTestCasecases unless a full cluster is really needed.Uh oh!
There was an error while loading. Please reload this page.
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.
@jtibshirani Thanks for the suggestion. I was trying to make this test in REST yml tests, but yml tests don't have nice comparison of float scores (you can't set up delta, and also there are errors with double -> float conversions).
I also considered adding this test in
DistanceFeatureQueryBuilderTests, but then I need to work on the Lucene level there. But what I wanted to test is how ES parses this query and what scores are returned. I could not find a smart way to do that in that test. WDYT?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.
Got it, that's good to know.
I guess we already test in
DistanceFeatureQueryBuilderTeststhat the query is parsed correctly, since we checkLatLonPointDistanceFeatureQueryhas a boost of 1.0f. I also don't see a convenient way to test query scoring in a unit test.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.
@jtibshirani
Indeed, the tests in DistanceFeatureQueryBuilderTests should be enough for this PR. I've removed a test from
SearchQueryIT.javain 7cbe160. We can introduce this test on scores later, when we need to test the correct scores.