The doc id not global:

new SimpleCollector() {
    private LeafReaderContext context;
    @Override
    public void collect(final int doc) throws IOException {
        // 
ids.add(indexSearcher.doc(doc).getField(ID_FIELD_NAME).stringValue());

        
ids.add(context.reader().document(doc).getField(ID_FIELD_NAME).stringValue());
        // OR
        ids.add(indexSearcher.doc(context.docBase +
doc).getField(ID_FIELD_NAME).stringValue());
    }
    @Override
    protected void doSetNextReader(LeafReaderContext context) throws
IOException {
        this.context = context;
    }
    @Override
    public ScoreMode scoreMode() {
        return ScoreMode.TOP_SCORES;
    }
}

On Tue, 26 Nov 2019 at 14:00, Joan LLuís Planas Papió
<[email protected]> wrote:
>
> Hello,
>
> I'm trying to understand why i'm getting duplicated results in the attached 
> java code.
> Debugging the code it seems that they come from differents segments. 
> Increasing the RAMBufferSizeMB to a level that all the docs are in the same 
> segment seems to return only unique numbers.
>
> There is any way to get unique documents in a bulk query without having to 
> cache then in a memory structure?
>
> Thanks in advance!!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to