atris commented on issue #1303: LUCENE-9114: Improve ValueSourceScorer's 
Default Cost Implementation
URL: https://github.com/apache/lucene-solr/pull/1303#issuecomment-593544138
 
 
   > Lets add the following test to TestFunctionRangeQuery:
   > 
   > ```
   >   @Test
   >   public void testTwoRangeQueries() throws IOException {
   >     Query rq1 = new FunctionRangeQuery(INT_VALUESOURCE, 2, 4, true, true);
   >     Query rq2 = new FunctionRangeQuery(INT_VALUESOURCE, 8, 10, true, true);
   >     Query bq = new BooleanQuery.Builder()
   >         .add(rq1, BooleanClause.Occur.SHOULD)
   >         .add(rq2, BooleanClause.Occur.SHOULD)
   >         .build();
   > 
   >     ScoreDoc[] scoreDocs = indexSearcher.search(bq, N_DOCS).scoreDocs;
   >     expectScores(scoreDocs, 10, 9, 8, 4, 3, 2);
   >   }
   > ```
   Thanks, will add it in a separate PR.
   
   > > Maybe have FunctionValues expose an abstract cost() method, have all FV 
derivatives implement it and then simply let VSC's matchCost use that method?
   > 
   > Yes; we certainly need the FV to provide the cost; the TPI.matchCost 
should simply look it up. By the FV (or VS) having a cost, it then becomes 
straight-forward for anyone's custom FV/VS to specify what their cost is. It's 
debatable wether this cost should be on the VS vs FV.
   
   Ok, so my next iteration will have a cost method in FV (I am inclined to add 
the method in FV since VSC has a direct member of that type?) and have VSC 
owned TPI's matchCost() refer to the cost of the delegated FV.
   
   I also feel that FV class itself should have a default implementation of 
cost method where it just returns a dumb value (100?) as the cost. The idea is 
that if you are using the default FV, you probably dont care about costs. If 
you plug in your own FV which has a smarter costing algorithm, VSC will 
automatically pick it up.
   
   WDYT?

----------------------------------------------------------------
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

Reply via email to