lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karl wettin <>
Subject Re: Gdata - opening/closing index
Date Sun, 23 Jul 2006 17:52:01 GMT
On Sun, 2006-07-23 at 19:10 +0200, Simon Willnauer wrote:

> So if I index every change immediately I have to open and close the
> index reader and writer all the time. This is not very efficient.

How often do you plan to close the readers and writers?

> Now the question is how does the indexer handle this? I 3could index
> into a second index while the first index used for  searching. The
> indexer could index all entries in the queue and after  a certain
> amount of new index entries both indexes could be merged  together.

I have spinal problems with this.

> But what happens if there is just one modification for 30  minutes.
> The entry would not be searchable for a long time.

I use a facade that supply the IndexSearcher. All code call this facade
every time it needs a searcher, and never bound to anything. When an
IndexReader or IndexWriter commits changes, a new searcher is created in
the facade and the old searcher is placed in a que for later closing to
avoid errors for any thread currently using it. 
The only thing I have to worry about is how often I commit changes. I
close my index writer after one minute of idleness or so.

You will find the code in directory /index of the tar-ball I attached to
issue 550 earlier today. It is a big fat layer of facade and decorators,
and you will have use NotifiableIndex.openWhatNot and
AutofreshedSearcher.getSearcher instead of creating your own instances.

I'm sure someone have a reason not to use this solution, but it works
great for me.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message