lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joseph Ottinger <j...@enigmastation.com>
Subject Re: How do I delete?
Date Tue, 01 Feb 2005 20:23:27 GMT
I've had success with deletion by running IndexReader.delete(int), then
getting an IndexWriter and optimizing the directory. I don't know if
that's "the right way" to do it or not.

On Tue, 1 Feb 2005, Jim Lynch wrote:

> I've been merrily cooking along, thinking I was replacing documents when
> I haven't.  My logic is to go through a batch of documents, get a field
> called "reference" which is unique build a term from it and delete it
> via the reader.delete() method.  Then I close the reader and open a
> writer and reprocess the batch indexing all.
>
> Here is the delete and associated code:
>
>               reader = IndexReader.open(database);
>
>               Term t = new Term("reference",reference);
>               try {
>                 reader.delete(t);
>               } catch (Exception e) {
>                 System.out.println("Delete exception;"+e);
>               }
>
> except it isn't working.  I tried to do a commt and a doCommit, but
> those are both protected.  I do a reader.close() after processing the
> batch the first time.
>
> What am I missing?  I don't get an exception.  Reference is definitely a
> valid field, 'cause I print out the value at search time and compare to
> the doc and they are identical.
>
> Thanks,
> Jim.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>

-----------------------------------------------------------------------
Joseph B. Ottinger                             http://enigmastation.com
IT Consultant                                    joeo@enigmastation.com


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


Mime
View raw message