lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Use of AllTermDocs with custom scorer
Date Mon, 16 Nov 2009 22:16:27 GMT
Can you remap your external data to be per segment?  Presumably hat
would make reopens faster for your app.

For your custom sort comparator, are you using FieldComparator?  If
so, Lucene calls setNextReader to tell you the reader & docBase.

Failing these, Lucene currently visits the readers in index order.
So, you could accumulate the docBase by adding up the reader.maxDoc()
for each reader you've seen.  However, this may change in future
Lucene releases.

You could also, externally, build your own map from SegmentReader ->
docBase, by calling IndexReader.getSequentialSubReaders() and stepping
through adding up the maxDoc.  Then, in your search, you can lookup
the SegmentReader you're working on to get the docBase?

Mike

On Mon, Nov 16, 2009 at 2:50 PM, Peter Keegan <peterlkeegan@gmail.com> wrote:
> The same thing is occurring in my custom sort comparator. The ScoreDocs
> passed to the 'compare' method have docIds that seem to be relative to the
> segment. Is there any way to translate these into index-wide docIds?
>
> Peter
>
> On Mon, Nov 16, 2009 at 2:06 PM, Peter Keegan <peterlkeegan@gmail.com>wrote:
>
>> I forgot to mention that this is with V2.9.1
>>
>>
>> On Mon, Nov 16, 2009 at 1:39 PM, Peter Keegan <peterlkeegan@gmail.com>wrote:
>>
>>> I have a custom query object whose scorer uses the 'AllTermDocs' to get
>>> all non-deleted documents. AllTermDocs returns the docId relative to the
>>> segment, but I need the absolute (index-wide) docId to access external data.
>>> What's the best way to get the unique, non-deleted docId?
>>>
>>> Thanks,
>>> Peter
>>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message