I'd write a shutdown method that calls close() in a controlled manner and invoke it at 23:55. You could also call commit() at whatever interval makes sense to you but if you carried on killing the JVM you'd still be liable to lose any docs indexed since the last commit.
This is standard stuff just like any file system or database. If you don't commit or close you are likely to lose data. -- Ian. On Thu, Oct 3, 2013 at 1:40 PM, Ramprakash Ramamoorthy <youngestachie...@gmail.com> wrote: > Team, > > We have our app using lucene 4.1. Docs keep getting indexed and we > close the index by 00.00 hrs every day and open a new one for the next > calendar day, however in case of an abrupt shutdown/kill of the JVM, the > app server crashes and the live indexes end up remaining without a > segments.gen file, and with a write.lock file. Say the abrupt shut down > happens by 23:55, all the documents indexed from 00:01 to 23:54 are lost. > NRT searchers function well before the shutdown. > > Is there anyway I can recover such indexes without a segments.gen? > Or committing periodically (say one hour once or when 1000 docs indexed) is > the only way? Or am I missing something very basic? Thanks in advance. > > -- > With Thanks and Regards, > Ramprakash Ramamoorthy, > Chennai, India. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org