lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saurabh Gokhale <>
Subject Questions on index Writer
Date Fri, 15 Jul 2011 19:03:40 GMT
Hi All,

I have following questions about lucene indexWriter. I am using version

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
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?



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message