Adrien Grand created LUCENE-10620:
-------------------------------------
Summary: Can we pass the Weight to Collector?
Key: LUCENE-10620
URL: https://issues.apache.org/jira/browse/LUCENE-10620
Project: Lucene - Core
Issue Type: Improvement
Reporter: Adrien Grand
Today collectors cannot know about the Weight, and thus they cannot leverage
{{Weight#count}}. {{IndexSearcher#count}} works around it by extending
{{TotalHitCountCollector}} in order to shortcut counting the number of hits on
a segment via {{Weight#count}} whenever possible.
It works, but I would prefer this shortcut to work for all users of
TotalHitCountCollector. For instance the faceting module creates a
MultiCollector over a TotalHitCountCollector and a FacetCollector, and today it
doesn't benefit from quick counts, which would enable it to only collect
matches into a FacetCollector.
I'm considering adding a new {{Collector#setWeight}} API to allow collectors to
leverage {{Weight#count}}. I gave {{TotalHitCountCollector}} as an example
above, but this could have applications for our top-docs collectors too, which
could skip counting hits at all if the weight can provide them with the hit
count up-front.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]