"Cauvery Developer" <[EMAIL PROTECTED]> wrote: > I know, I can I use IndexWriter with createFlag set to false while > updating. But, this sounds too "comprehensive".
Nomatter what if you are going to update a document, you will have to open a writer for doing so (or, use a writer you already have open). > I am trying to implement Lucene for a small set of source files, where > the entire source is the value for a Field named 'source'. Creating > the field was easy because there is a constructor for Field using a > BufferedReader. When there are changes in the source file, I need to > update the Document in the Index using updateDocument(Term, Document). > Since, a Term is "...is composed of two elements, the text of the > word, as a string, and the name of the field that the text occured > in...", I would have to build the Term with the modified source. But, > there isn't such a constructor for Term. The Term that you pass as the first argument to updateDocument must "identify" the document you want to replace. EG you could add a field "documentID" that has a unique value per document. You then pass in Term("documentID", <string-ID>) to updateDocument. In your case maybe you could use a canonical fileName or URI to identify the document. Then, you put your modified source as a Field into the second argument (document) to the updateDocument method. Mike --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]