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
distance_influence should not get a default value if no value is specified #2716
Changes from 4 commits
2091d33
1a32582
3a443b5
8ae8077
945f484
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 |
---|---|---|
|
@@ -23,10 +23,11 @@ public class FindMinMax { | |
public static void checkLMConstraints(CustomModel baseModel, CustomModel queryModel, EncodedValueLookup lookup) { | ||
if (queryModel.isInternal()) | ||
throw new IllegalArgumentException("CustomModel of query cannot be internal"); | ||
if (queryModel.hasDistanceInfluence() && queryModel.getDistanceInfluence() < baseModel.getDistanceInfluence()) | ||
double qmDI = queryModel.hasDistanceInfluence() ? queryModel.getDistanceInfluence() : 0; | ||
double bmDI = baseModel.hasDistanceInfluence() ? baseModel.getDistanceInfluence() : 0; | ||
Comment on lines
+26
to
+27
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. Here the 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.
Not sure. Isn't it more an artifact of the "Double" type? It would be implicit for "double".
Even if your request is without (de)serialization you can still have null values. 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. Yes, I thought after reading the config file the distance influence field of the server-side model should either be 0 (if nothing was specified) or whatever was specified in the server config, but never So basically I think that And for if (queryModel.getDistanceInfluence() != null && queryModel.getDistanceInfluence() < baseModel.getDistanceInfluence())
throw new IllegalArgumentException("CustomModel in query can only use " +
"distance_influence bigger or equal to " + baseModel.getDistanceInfluence() + ", but was: " + queryModel.getDistanceInfluence()); 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. Ok, I see this is not the way we do it currently. We do not apply the default server-side value during the deserialization of |
||
if (qmDI < bmDI) | ||
throw new IllegalArgumentException("CustomModel in query can only use " + | ||
"distance_influence bigger or equal to " + baseModel.getDistanceInfluence() + | ||
", but was: " + queryModel.getDistanceInfluence()); | ||
"distance_influence bigger or equal to " + bmDI + ", but was: " + qmDI); | ||
|
||
checkMultiplyValue(queryModel.getPriority(), lookup); | ||
checkMultiplyValue(queryModel.getSpeed(), lookup); | ||
|
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.
Maybe extract a constant as this
0
is the server-side default value and it appears also inFindMinMax
.