lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pulkit Singhal <pulkitsing...@gmail.com>
Subject Update Document based on Query instead of Term
Date Wed, 13 Apr 2011 13:15:15 GMT
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
View raw message