You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by VIGNESH S <vi...@gmail.com> on 2013/08/06 13:38:59 UTC

Best Way to delete a Lucene Index

Hi,

which is the best way to delete a lucene document in a large index?

-- 
Thanks and Regards
Vignesh Srinivasan
9739135640

Re: Best Way to delete a Lucene Index

Posted by Michael McCandless <lu...@mikemccandless.com>.
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 <vi...@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 <
> lucene@mikemccandless.com> wrote:
>
>> Use IndexWriter.deleteDocument.
>>
>> Mike McCandless
>>
>> http://blog.mikemccandless.com
>>
>>
>> On Tue, Aug 6, 2013 at 7:38 AM, VIGNESH S <vi...@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-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
>
>
> --
> Thanks and Regards
> Vignesh Srinivasan
> 9739135640

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Best Way to delete a Lucene Index

Posted by VIGNESH S <vi...@gmail.com>.
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 <
lucene@mikemccandless.com> wrote:

> Use IndexWriter.deleteDocument.
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
> On Tue, Aug 6, 2013 at 7:38 AM, VIGNESH S <vi...@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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
Thanks and Regards
Vignesh Srinivasan
9739135640

Re: Best Way to delete a Lucene Index

Posted by Michael McCandless <lu...@mikemccandless.com>.
Use IndexWriter.deleteDocument.

Mike McCandless

http://blog.mikemccandless.com


On Tue, Aug 6, 2013 at 7:38 AM, VIGNESH S <vi...@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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org