atris 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_r387449993
########## 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 felt that DEF_COST defines the cost of the VSC.matches call itself and if the user prefers to do a complex cost, then override matchCost() :) I agree with your approach, added the cost evaluation method as a separate class method ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org