lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Williams <william...@gmail.com>
Subject Re: IndexWriter update method
Date Sat, 18 Apr 2009 00:05:33 GMT
On Fri, Apr 17, 2009 at 7:27 PM, Newman, Billy <Billy.Newman@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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message