lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aruna Raghavan <Aru...@opin.com>
Subject Deleting documents
Date Fri, 08 Mar 2002 18:40:07 GMT
Hi,
Is there anything wrong with the following code?
      try {
       m_lock.write(); // obtain a write lock on a RWLock
       IndexReader indexReader = IndexReader.open("mypath");
       IndexSearcher indexSearcher = new IndexSearcher("mypath");
      // use the searcher to search for documents to be deleted
      // use the reader to do the deletes.
      indexReader.close();
      }
      catch(Throwable e)
      {   
           e.printStackTrace();
      }
      finally
      {
           m_lock.unlock();
      }

Sometimes I am getting the following exception:
java.io.IOException: Index locked for write:
Lock@D:\RevealCS\Search\Data\reports\write.lock
	at org.apache.lucene.index.IndexReader.delete(Unknown Source)
	at org.apache.lucene.index.IndexReader.delete(Unknown Source)
	at
revsearch.RevSearch$DeleteWatcherThread.checkAction(RevSearch.java:1455)
	at revsearch.RevSearch$WatcherThread.run(RevSearch.java:250)

This exception was not happening every time the code was run, it was
intermittent.

I suspect it is because I am using indexSearcher and indexWriter to open the
myPath dir. I changed it such that indexSearcher uses the indexReader in the
constructor.

I am hoping that some one can shed some light on what went wrong, thanks.
Aruna.



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


Mime
View raw message