I'm working with some folks who did some profiling and noticed that
ScorerSupplier.cost() can be expensive (as the javadocs say). cost() says
only to call it if necessary. Unfortunately, a BooleanQuery is going to
call cost() (via BooleanWeight.scorer() even if ultimately no Query in the
tree cares what the cost is.  I'm not sure if that's a perf bug or not;
it's hard to tell.

The expensive part of cost() for Boolean2ScorerSupplier is over in
MinShouldMatchSumScorer.cost which creates a PriorityQueue every time, even
if trivially numScorers == 1.  That's a weird case... why do we even need a
Boolean2ScorerSupplier around one clause; couldn't that clause be returned
from the outer weight, BooleanWeight.scorerSupplier() close to the end as
an optimization?  I could file an issue.

~ David
-- 
Lucene/Solr Search Committer, Consultant, Developer, Author, Speaker
LinkedIn: http://linkedin.com/in/davidwsmiley | Book:
http://www.solrenterprisesearchserver.com

Reply via email to