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?
Mike
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
reader.termPositions(term);
termPositions.skipTo(scoreDoc.doc);
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
termPositions.skipTo(scoreDoc.doc);
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.
Antony
---------------------------------------------------------------------
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]