lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: Reopen IndexWriter after delete?
Date Thu, 13 Nov 2003 15:35:00 GMT
Because Lucene has to first find the segment that the specified
document is in, and this is done via IndexReaders, not IndexWriters.

More about this in the Lucene book.

Otis


--- Dror Matalon <dror@zapatec.com> wrote:
> Which begs the question: why do you need to use an IndexReader rather
> than an IndexWriter to delete an item?
> 
> On Tue, Nov 11, 2003 at 02:46:37PM -0800, Otis Gospodnetic wrote:
> > > 1).  If I delete a term using an IndexReader, can I use an
> existing
> > > IndexWriter to write to the index?  Or do I need to close and
> reopen
> > > the IndexWriter?
> > 
> > No.  You should close IndexWriter first, then open IndexReader,
> then
> > call delete, then close IndexReader, and then open a new
> IndexWriter.
> > 
> > > 2).  Is it safe to call IndexReader.delete(term) while an
> IndexWriter
> > > is
> > > writing?  Or should I be synchronizing these two tasks so only
> one
> > > occurs at a time?
> > 
> > No, it is not safe.  You should close the IndexWriter, then delete
> the
> > document and close IndexReader, and then get a new IndexWriter and
> > continue writing.
> > 
> > Incidentally, I just wrote a section about concurrency issues and
> about
> > locking in Lucene for the upcoming Lucene book.
> > 
> > Otis
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Protect your identity with Yahoo! Mail AddressGuard
> > http://antispam.yahoo.com/whatsnewfree
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> > 
> 
> -- 
> Dror Matalon
> Zapatec Inc 
> 1700 MLK Way
> Berkeley, CA 94709
> http://www.fastbuzz.com
> http://www.zapatec.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

---------------------------------------------------------------------
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