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

Atri Sharma commented on LUCENE-8970:
-------------------------------------

I did a prototype of this –- it is a bit hairy since, unlike TopDocsCollector, 
TopFieldComparator
does not directly perform comparisons against the bottom but instead uses 
FieldComparator
to do the job. The problem is that FieldComparatorcould maintain its internal 
queue, which needs to be accordingly set with sentinel values if the queue is 
prepopulated. This works well with straight implementations, but for 
comparators like RelevanceComparator, which do not use the passed in slot but 
instead depend on the presence of the scorer instance to generate the doc to be 
placed, this can be an issue.

I wonder if it is worth exposing a prePopulate API in FieldComparator which 
does what it advertises – allows prepopulating the internal structure used for 
maintaining docID mappings.

> TopFieldCollector(s) Should Prepopulate Sentinel Objects
> --------------------------------------------------------
>
>                 Key: LUCENE-8970
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8970
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Atri Sharma
>            Priority: Major
>
> We do not repopulate the hit queue with sentinel values today, thus leading 
> to extra checks and extra code.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to