lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Lucene indexes getting deleted after application restart
Date Wed, 06 Jul 2016 22:15:01 GMT
Call IW.commit on a periodic basis, e.g. every N (!= 1) docs, or every M
bytes or something?

Mike McCandless

http://blog.mikemccandless.com

On Wed, Jul 6, 2016 at 1:57 PM, Desteny Child <myshareit@gmail.com> wrote:

> Hi!
>
> In my Spring/Lucene application I'm using Lucene IndexWriter,
> TrackingIndexWriter, SearcherManager and ControlledRealTimeReopenThread.
>
> I use open mode - IndexWriterConfig.OpenMode.CREATE_OR_APPEND.
>
> Right now I'm trying to index a thousands of a documents. For this purpose
> I have added Apache ActiveMQ and indexing every document in a separate
> message consumer.
>
> I noticed one serious issue - in case of abnormal JVM termination after the
> next application restart my Lucene index is empty because
> IndexWriter.commit() operation was not performed.
>
> If I invoke IndexWriter.commit() after each
> trackingIndexWriter.addDocument(document); everything works fine.
>
> I don't think it is a good idea to use IndexWriter.commit() after each
> trackingIndexWriter.addDocument(document); especially from performance
> point of view.
>
> How to correctly manage my index in order to not lose it after application
> abnormal termination?
>
> Thanks,
> Alex
>

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