lucene-java-user mailing list archives

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

Cam Bazz wrote:

> Yes, I noticed
> http://www.archivum.info/java-dev@lucene.apache.org/2006-09/ 
> 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.

Mike

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


Mime
View raw message