You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by Min Yin <yi...@AI.SRI.COM> on 2008/06/11 01:53:44 UTC

How do I update a document without first delete and then add

Hi there,

Sorry for the naive question, but I couldn't seem to find a way to 
update a document (i.e., one or multiple fields of a document) without 
first delete the old one and then add a new one, in other words, I'd 
like to keep the old document id. But I only find 
IndexWriter.updateDocument(term, doc) which "Updates a document by first 
deleting the document(s) containing |term| and then adding the new 
document". Any idea?

Thanks in Advance!
Min

RE: How do I update a document without first delete and then add

Posted by Michael Garski <mg...@myspace.com>.
Min,

The only way to update a document is to first delete the existing one,
then re-add it.  There is no way to retain the same document id when
this is done.

Michael

-----Original Message-----
From: Min Yin [mailto:yin@AI.SRI.COM] 
Sent: Tuesday, June 10, 2008 4:54 PM
To: lucene-net-user@incubator.apache.org
Subject: How do I update a document without first delete and then add

Hi there,

Sorry for the naive question, but I couldn't seem to find a way to 
update a document (i.e., one or multiple fields of a document) without 
first delete the old one and then add a new one, in other words, I'd 
like to keep the old document id. But I only find 
IndexWriter.updateDocument(term, doc) which "Updates a document by first

deleting the document(s) containing |term| and then adding the new 
document". Any idea?

Thanks in Advance!
Min