lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: delete a document from indexwriter
Date Tue, 22 Jan 2008 10:05:49 GMT

Cam Bazz wrote:

> Yes, I noticed
> msg00065.html
> Somehow I gotta do my delete within the same writer. I could use  
> another
> field that combines both src and dst field, and use this field without
> storing but still a waste of resources.
> I wonder if IndexWriter can be modified to accept a boolean query  
> with termA
> and termB - instead of single term?

If we go this route, we should add deleteByQuery to IndexWriter,  
which I think is a good idea, but just hasn't been done yet....

It was discussed before, in the context of LUCENE-565, but never  
actually added to IndexWriter.  I think the approach would be similar  
to how IndexWriter now deletes by Term.

> I read the code until the part where deleted the term is added to a  
> hashmap,
> but could not follow on after that.

Basically, the terms are buffered into a HashMap.  Then when a flush  
happens, a SegmentReader is opened one by one on all segments, and  
the delete is applied to each segment.  Special logic is used to  
apply the delete to the just-flushed segment since you have to take  
care to only delete docIDs up until the point when the delete by term  
was called.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message