lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anshum <ansh...@gmail.com>
Subject Re: Update Document based on Query instead of Term
Date Wed, 13 Apr 2011 13:35:15 GMT
So Update basically is nothing but delete and add (a fresh doc). You could
just go ahead at using the deletedocument(Query query) function and then
adding the new document? That is the general approach for such cases and it
works just about fine.

--
Anshum Gupta
http://ai-cafe.blogspot.com


On Wed, Apr 13, 2011 at 6:45 PM, Pulkit Singhal <pulkitsinghal@gmail.com>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)
>
> 1) How can this be done? As far as I know there is no such method
> signature right now. In my data there is no way for me to uniquely
> identify a document for update without matching more that one term, so
> I really need to use a Query.
> 2) Would it be better to change the initial underlying indexing
> process such that the multiple fields (that can identify a unique
> document) will be concatenated into one string and indexed? Then that
> field can be used for identification when doing updates? Is this the
> common practice?
> 3) Or, would it be better to use the Query I have to search for the
> docID that the Lucene index assigns to the data inside it and then try
> to update based on that? Will I get in trouble here somehow?
>
> Any tips are appreciated.
>
> Thanks!
> - Pulkit
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message