[email protected]
[Top] [All Lists]

Re: Can TermDocs.skipTo() go backwards

Subject: Re: Can TermDocs.skipTo() go backwards
From: Michael McCandless
Date: Wed, 27 Aug 2008 05:44:37 -0400

TermDocs.skipTo() only moves forwards.

Can you use a stored field to retrieve this information, or do you really need to store it per-term-occurrence in your docs?


Antony Bowesman wrote:

I have a custom TopDocsCollector and need to collect a payload from each final document hit. The payload comes from a single term in each hit.

When collecting the payload, I don't want to fetch the payload during the collect() method as it will make fetches which may subsequently be bumped from the topDocs, so I want to fetch it during the topDocs() call.

I made some performance tests on a simple index of 5M documents. If I do


it takes up to 282 ms just to make the skipTo.

The javadocs imply that skipTo() can only go forwards and as scoreDocs is in score order, not docId order, I suppose it's not possible to just use


unless skipTo() can go both backwards. Can it? Javadocs imply there is more than one type of implementation.

If not I suppose I must resort the scoreDocs by docId order and then loop with termPositions.skipTo(scoreDoc.doc). The number of hits will be typically small so it'll be fast enough.


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

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

<Prev in Thread] Current Thread [Next in Thread>