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

Adrien Grand commented on LUCENE-9619:
--------------------------------------

Thanks for the feedback [~ivera]!

I initially wanted to remove the visitor pattern entirely, but this made it 
challenging to retain some optimizations we have like the one we have to do 
only one comparison in case multiple documents share the same value: 
https://github.com/apache/lucene-solr/blob/af47cb7bcdd4eb10263a0586474c6e255307bbbb/lucene/core/src/java/org/apache/lucene/index/PointValues.java#L219-L224.

As far as implementing a DocIdSetIterator is concerned, my thinking was that 
this API could be use to fill an int[] buffer only one leaf at a time, so we 
wouldn't allocate more than an int[512] with the current Points file format. 
This wouldn't provide skipping capabilities, but at least we wouldn't need to 
maintain a giant int[] or BitSet.

> Move Points from a visitor API to a custor-style API?
> -----------------------------------------------------
>
>                 Key: LUCENE-9619
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9619
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Adrien Grand
>            Priority: Minor
>
> Points' visitor API work well but there are a couple things we could make 
> better if we moved to a cursor API, e.g.
>  - Term queries could return a DocIdSetIterator without having to materialize 
> a BitSet.
>  - Nearest-neighbor search could work on top of the regular API instead of 
> casting to BKDReader 
> https://github.com/apache/lucene-solr/blob/6a7131ee246d700c2436a85ddc537575de2aeacf/lucene/sandbox/src/java/org/apache/lucene/sandbox/document/FloatPointNearestNeighbor.java#L296
>  - We could optimize counting the number of matches of a query by adding the 
> number of points in a leaf without visiting documents where there are no 
> deleted documents and a leaf fully matches the query.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to