On Fri, Apr 17, 2009 at 7:27 PM, Newman, Billy <billy.new...@itt.com> wrote:
> I am looking for info on how to use the IndexWriter.update method.  A short 
> example of how to add a document and then later update would
> be very helpful.  I get lost because I can add a document with just the 
> document, but I need a document and a Term.  I am not really sure
> what a Term is since I did not use a Term to create the document nor do I see 
> it in any of the examples of searching/adding.

When you index the document, add an ID field that is unique.  Then
when you go to update the document the "Term" will be the ID of the
document you wish to update.  For example, you might add a URL as the
unique ID, then to update it might look something like:

writer.update(new Term("id","http://apache.org/lucene/index.htm";), doc)


--tim

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

Reply via email to