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 Paul Williams <pa...@valinf.com> on 2003/12/30 18:07:01 UTC

Error deleting a document when using the compound file index

Hi,

I am just testing Lucene 1.3 RC with the Compound index option on. When I
come to delete an existing document in the index to re-update a document, I
get an unable to obtain lock error.

java.io.IOException: Lock obtain timed out
	at org.apache.lucene.store.Lock.obtain(Lock.java:97)
	at org.apache.lucene.index.IndexReader.delete(IndexReader.java:279)
	at org.apache.lucene.index.IndexReader.delete(IndexReader.java:312)
	at objects.CH_Lucene.updateDocument(CH_Lucene.java:1065)
	at
servlets.CH_SearchConnection.updateDocument(CH_SearchConnection.java:1048)
	at
functions.CH_UpdateThread.updateDocument(CH_UpdateThread.java:255)
	at functions.CH_UpdateThread.run(CH_UpdateThread.java:132)

I am using the following snippet of code to remove the previous document
entry.

DecimalFormat df = new DecimalFormat("########");
df.setMinimumIntegerDigits(8);
		
Term docNumberTerm = new Term("Field10", df.format(ldoc));

IndexReader reader = IndexReader.open(location);
		
// Delete old term if present
if (reader.docFreq(docNumberTerm) > 0)
{
	reader.delete(docNumberTerm);
}
reader.close();

I did not get this when I was using the normal index file structure. Is
there a way round this?

Regards,

Paul


DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee.  Access to this
message by anyone else is unauthorised.  If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful.  Please immediately contact the sender if you have received this
message in error. Thank you. Copyright Valid Information Systems Limited.
http://www.valinf.com Address Morline House, 160 London Road, Barking,
Essex, IG11 8BB. Tel: 020 8215 1414 Fax: 020 8215 2040. 



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


Re: Error deleting a document when using the compound file index

Posted by Terry Steichen <te...@net-frame.com>.
Paul,

I just started using 1.3 final (labeled 1.4 RC1) and ran into a similar
problem (though I'm not using the compound file option).  My code ran just
fine all the way through 1.3RC3, but with the latest release, the
reader.delete() threw a "Lock obtain timed out" IOException.  What I finally
did was locate the place earlier in my code where the FSDirectory was first
created, and immediately followed it with a call to
IndexReader.unlock(fsdir).  So far, that appears to have done the trick (but
I haven't had much time to fully test it yet).

Regards,

Terry

----- Original Message -----
From: "Paul Williams" <pa...@valinf.com>
To: "'Lucene Users List'" <lu...@jakarta.apache.org>
Sent: Tuesday, December 30, 2003 12:07 PM
Subject: Error deleting a document when using the compound file index


> Hi,
>
> I am just testing Lucene 1.3 RC with the Compound index option on. When I
> come to delete an existing document in the index to re-update a document,
I
> get an unable to obtain lock error.
>
> java.io.IOException: Lock obtain timed out
> at org.apache.lucene.store.Lock.obtain(Lock.java:97)
> at org.apache.lucene.index.IndexReader.delete(IndexReader.java:279)
> at org.apache.lucene.index.IndexReader.delete(IndexReader.java:312)
> at objects.CH_Lucene.updateDocument(CH_Lucene.java:1065)
> at
> servlets.CH_SearchConnection.updateDocument(CH_SearchConnection.java:1048)
> at
> functions.CH_UpdateThread.updateDocument(CH_UpdateThread.java:255)
> at functions.CH_UpdateThread.run(CH_UpdateThread.java:132)
>
> I am using the following snippet of code to remove the previous document
> entry.
>
> DecimalFormat df = new DecimalFormat("########");
> df.setMinimumIntegerDigits(8);
>
> Term docNumberTerm = new Term("Field10", df.format(ldoc));
>
> IndexReader reader = IndexReader.open(location);
>
> // Delete old term if present
> if (reader.docFreq(docNumberTerm) > 0)
> {
> reader.delete(docNumberTerm);
> }
> reader.close();
>
> I did not get this when I was using the normal index file structure. Is
> there a way round this?
>
> Regards,
>
> Paul
>
>
> DISCLAIMER: The information in this message is confidential and may be
> legally privileged. It is intended solely for the addressee.  Access to
this
> message by anyone else is unauthorised.  If you are not the intended
> recipient, any disclosure, copying, or distribution of the message, or any
> action or omission taken by you in reliance on it, is prohibited and may
be
> unlawful.  Please immediately contact the sender if you have received this
> message in error. Thank you. Copyright Valid Information Systems Limited.
> http://www.valinf.com Address Morline House, 160 London Road, Barking,
> Essex, IG11 8BB. Tel: 020 8215 1414 Fax: 020 8215 2040.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>


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