lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Causse <dcau...@spotter.com>
Subject Re: Update Document based on Query instead of Term
Date Wed, 13 Apr 2011 13:51:17 GMT
On Wed, Apr 13, 2011 at 09:15:15AM -0400, Pulkit Singhal wrote:
> Lucene's IndexWriter allows users to update documents by Term via this
> method signature:
> void updateDocument(Term term, Document doc)
> 
> But what about updating them by Query? Like so:
> void updateDocument(Query query, Document doc)

Hi,

as updateDocument(Term t, Document d) is just a delete + add, you can
use :
IndexWriter.delete(Query query);
IndexWriter.add(Document d);

Regards.

-- 
David Causse
Spotter
http://www.spotter.com/

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