dsmiley commented on a change in pull request #1303: LUCENE-9114: Improve
ValueSourceScorer's Default Cost Implementation
URL: https://github.com/apache/lucene-solr/pull/1303#discussion_r387438580
##########
File path:
lucene/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java
##########
@@ -55,7 +59,13 @@ public boolean matches() throws IOException {
@Override
public float matchCost() {
- return 100; // TODO: use cost of ValueSourceScorer.this.matches()
+ // If an external cost is set, use that
+ if (externallyMutableCost != 0.0) {
+ return externallyMutableCost;
+ }
+
+ // Cost of iteration is fixed cost + cost exposed by delegated
FunctionValues instance
+ return DEF_COST + values.cost();
Review comment:
I suppose the purpose of DEF_COST here is to add on the cost of the
ValueSourceScorer.matches code that is separate from fetching the value from
the FunctionValues. That cost varies by the VSC subclass. If we want to be
thorough then maybe _this_ should be settable somehow _as well_? One easy way
to do this is to simply refactor out this one line (def cost + FV cost) into a
protected method on the VSC that may be over-ridden if desired. Or we could
just say that is too pedantic, and prefer simplicity. I'm fine either way.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]