You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Ype Kingma <yk...@xs4all.nl> on 2003/01/10 22:45:42 UTC

Re: internal record numbers?

On Friday 10 January 2003 22:47, you wrote:
> I was wondering if lucene had some way (internal record numbers, whatever)
> so that I could limit search results to say a range of documents, in the
> order they were added?
>
> I understand that I could have a field called "myownrecordnumber" and put a
> number
> into it. This won't work for me as the index is constantly being added to
> and
> removed from, and my ultimate goal is to use this so I can start at a
> particular
> point in time (record number) and search the next 1000 documents that were
> added.
> (We using the results from lucene in some analytics and batch up the runs)
>
> If I use "myownrecordnumber" I would have to reindex and fix the numbers 
> to get the
> same effect which is not a possibility as it takes too long, and requires
> too much downtime.
>
> Over time there would obviously be alot of holes, and what I'd like is for
> optimizing
> the index to magically fix/reorder the record numbers if they existed :)

AFAICS the document number used by the IndexReader does
precisely what you want. An inserted document gets the next available
document number and optimizing an index fills the deletion gaps
while keeping insertion order.

If you use the lower level search API you get the document number and
the score for each query, so you can simply ignore any document
number outside your prefered range. It might faster to use a limiting bit 
vector since this will prevent the score from being computed for documents
that you are not interested in. See the same lower level search API for 
details.

Have fun,
Ype

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>