lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <>
Subject Re: Questions on index Writer
Date Sat, 16 Jul 2011 19:34:17 GMT
My advice: Don't close the IndexWriter - just call commit. Don't worry about forcing merges
- let them happen as they do when you call commit.

If you are going to use the IndexWriter again, you generally do not want to close it. Calling
commit is the preferred option.

- Mark Miller

On Jul 15, 2011, at 3:03 PM, Saurabh Gokhale wrote:

> Hi All,
> I have following questions about lucene indexWriter. I am using version
> 3.1.0.
> While indexing documents,
> 1. When is the good time to commit changes? (indexWriter.commit) or just
> close the writer after the indexing is done so that commit automatically
> happens.
> 2. When is the good time to merge indexes (indexWriter.maybeMerge()).  Is it
> just before committing the changes or after indexing say X number of
> documents. (I recently upgraded from 2.9.4 to 3.1 and I see 3.1 lucene
> generates lot of small index files while indexing document)
> Also I have a problem where my lucene index files sometimes gets deleted
> from the index folder. I am not sure what code snippet is causing the
> existing index files to accidently get removed.
> My indexer runs in a thread loop where it indexes file whenever they are
> available. When no more files are available, indexer thread closes the
> writer and goes to sleep, after specific time, it again creates a new index
> on the same folder and starts indexing new files if any available.
> A. Is it a wrong way to index files?
> B. Because I close the index and open it again later, am I seeing my lucene
> index files getting deleted?
> Thanks
> Saurabh

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

View raw message