[ 
https://issues.apache.org/jira/browse/LUCENE-10620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17558563#comment-17558563
 ] 

ASF subversion and git services commented on LUCENE-10620:
----------------------------------------------------------

Commit e983d391d71f3f3a628eb5520e8714623ac05202 in lucene's branch 
refs/heads/branch_9x from Adrien Grand
[ https://gitbox.apache.org/repos/asf?p=lucene.git;h=e983d391d71 ]

LUCENE-10620: Pass the Weight to Collectors. (#964)

This allows `Collector`s to use `Weight#count` when appropriate.

> 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
>            Priority: Minor
>             Fix For: 9.3
>
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> 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: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to