lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Renata Vaccaro <>
Subject RE: IndexWriter.commit() performance
Date Tue, 04 Jun 2013 23:31:17 GMT
Thanks.  I need the documents to be searchable as soon as they are
added.  I also need the documents added to survive a machine crash.  

Soft commits and NRT gets might work, but from what I've read they are
only available for Solr?

-----Original Message-----
From: Mark Bennett [] 
Sent: Tuesday, June 04, 2013 7:07 PM
To: <>
Subject: Re: IndexWriter.commit() performance

Although it's not exactly what you asked (and I don't mean this as a
sarcastic answer), one idea is to not call it directly from your code.
Or use the options that say "commit with N seconds"

This may not be feasible, depending on your requirements, and I'd
certainly respect that.  But, if you're looking at old examples and that
is what's motivating your question, it's good to know about the other
options available.

There's also soft commits and NRT gets, also interesting reading.

Mark Bennett / LucidWorks: Search & Big Data /
Office: 408-898-4201 / Telecommute: 408-733-0387 / Cell: 408-829-6513

On Jun 4, 2013, at 3:50 PM, Renata Vaccaro <>

> Hi all,
> I'm new to this list and hoping I'm asking this question in the
> place.  I upgraded lucene from a very, very old version to version
> 4.2.1.  I'm finding that calling IndexWriter.commit() is much slower
> than the previous IndexWriter.close() that I was calling with the old
> lucene (that didn't have a commit call).  It's taking 500ms-1s where
> previously the close call was taking about 50ms.  I call commit every
> time I add a document.  I am creating the IndexWriter as follows:
> Directory dir =;
>      Analyzer analyzer = new MsStandardAnalyzer();
>      IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_42,
> analyzer);
>      iwc.setOpenMode(OpenMode.CREATE_OR_APPEND);
>      iwc.setRAMBufferSizeMB(256.0);
> IndexWriter writer = new IndexWriter(dir, iwc);
> Is there something that I can do to make the commit call faster?

View raw message