You can use IndexWriter.unlock(Directory) to forcefully unlock the index; just be certain the old IndexWriter really is gone before doing that.
Or, if you have an IndexWriter still open, you could try IndexWriter.rollback(), which discards all changes and closes the IndexWriter. Or perhaps IndexWriter.deleteAll followed by commit. When you get LockObtainFailedException it means your lock file is still present and "locked"; what Directory and LockFactory are you using? Mike McCandless http://blog.mikemccandless.com On Tue, Aug 6, 2013 at 8:06 AM, VIGNESH S <vigneshkln...@gmail.com> wrote: > Hi Mike, > > Thanks for Your Reply. > > Actually My question is wrong. > > I have a large Index with a open IndexWriter.some one unknowlingly deleted > some files in the index and corrupted the index. > > Once i get IndexCorruptedException,I will delete the entire Index Folder > and close my indexwriter also and Restart indexing process again. > > In that time,I am Still Getting LockObtainedFailedException. > > I am running this in a android device. > > When i reboot the device,Indexing happens properly but without rebooting > iam getting LockObtainedFailedException. > > Please kindly help me > > > > On Tue, Aug 6, 2013 at 5:13 PM, Michael McCandless < > luc...@mikemccandless.com> wrote: > >> Use IndexWriter.deleteDocument. >> >> Mike McCandless >> >> http://blog.mikemccandless.com >> >> >> On Tue, Aug 6, 2013 at 7:38 AM, VIGNESH S <vigneshkln...@gmail.com> wrote: >> > Hi, >> > >> > which is the best way to delete a lucene document in a large index? >> > >> > -- >> > Thanks and Regards >> > Vignesh Srinivasan >> > 9739135640 >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >> For additional commands, e-mail: java-user-h...@lucene.apache.org >> >> > > > -- > Thanks and Regards > Vignesh Srinivasan > 9739135640 --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org