Dror Matalon wrote:
There are two issues:
1. Having new searches start using the new index only when it's ready,
not in a "half baked" state, which means that you have to synchronize
the switch from the old index to the new one.
That's true. If you're doing updates (as opposed to just additions)
then you probably want to do something like:
1. keep a single open IndexReader used by all searches
2. Every few minutes, process updates as follows:
a. open a second IndexReader
b. delete all documents that will be updated
c. close this IndexReader, to flush deletions
d. open an IndexWriter
e. add all documents that are updated
f. close the IndexReader
g. replace the IndexReader used for searches (1, above)
2. It's not trivial to figure out when it's safe to discard the old
index; all existing searches are done with it.

To make things more complicated, the Hits object is dependent on your
IndexSearcher object, so if you have Hits objects in use you probably
can't close your IndexSearcher.

Is this a correct analysis or is there an obvious strategy to work
around this issue?
Right, you cannot safely close the IndexReader that's being used for
searching. Rather, just drop it on the floor and let it get garbage
collected. Its files will be closed when this happens. Provided you're
not updating more frequently than the garbage collector runs, you should
only ever have two IndexReaders open and shouldn't run into file handle


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

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 23 of 26 | next ›
Discussion Overview
groupjava-user @
postedOct 31, '03 at 9:33p
activeDec 19, '03 at 8:43a



site design / logo © 2021 Grokbase