Hi Alexander, In general, advance(target) is best used to implement queries and advanceExact(target) for collectors.
See javadocs for advanceExact(target), this method may only be called on doc IDs that are between 0 included and maxDoc excluded. On Thu, Feb 3, 2022 at 10:00 AM Alexander Buloichik <alexander_buloic...@epam.com.invalid> wrote: > > Hi. > > I'm trying to retrieve field values in my own LeafCollector (Lucene 8.11.1). > But I didn't find good tutorial how to do it. > So, I get SortedSetDoc from LeafReader, then Lucene calls my implementation > of LeafCollector.collect() method, and I try to get values from SortedSetDoc > inside my implementation of LeafCollector.collect() method. > > What should I call for move SortedSetDoc's pointer to the required > document('doc' parameter of LeafCollector.collect(int doc)) ? advance(doc) or > advanceExact(doc) ? > > I'm using SortedSetDoc.advanceExact() and it works good. > > But when I'm trying to call BinaryDocValues.advanceExact() for other field, > it always returns true (see Lucene80DocValuesProducer.java:685), even in case > doc >= maxDoc. > If I'm using advance(doc) and checking that "advance(doc)==doc" (against case > of "document number is greater to target") - it works good. > > But SortedSetDoc.advance(doc) always returns 'doc+1', not a 'doc' > (IndexedDISI.java:385). > > -- > Alexander Buloichik > -- Adrien --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org