lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pablo Mendes <pablomen...@gmail.com>
Subject IndexWriter.mergeDocument(Term term, Document doc)
Date Tue, 29 Jun 2010 15:58:28 GMT
Hi all,
I'm looking for a functionality similar to IndexWriter.updateDocument()

*IndexWriter.**updateDocument<http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/index/IndexWriter.html#updateDocument%28org.apache.lucene.index.Term,%20org.apache.lucene.document.Document%29>
*(Term<http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/index/Term.html>
term,
Document<http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/document/Document.html>
 doc)
          Updates a document by first deleting the document(s) containing
term and then adding the new document.

*IndexWriter.**updateDocument<http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/index/IndexWriter.html#updateDocument%28org.apache.lucene.index.Term,%20org.apache.lucene.document.Document,%20org.apache.lucene.analysis.Analyzer%29>
*(Term<http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/index/Term.html>
term,
Document<http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/document/Document.html>
doc,
Analyzer<http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/analysis/Analyzer.html>
 analyzer)
          Updates a document by first deleting the document(s) containing
term and then adding the new document.

But instead of deleting the document containing term and then adding the new
document,
I'd like to merge the information from the new document with the document
containing the term .

*IndexWriter.merge**Document*(Term<http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/index/Term.html>
term,
Document<http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/document/Document.html>
 doc)
          Updates a document by merging the information in the document
containing term and the new document.

*IndexWriter.merge**Document*(Term<http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/index/Term.html>
term,
Document<http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/document/Document.html>
 doc, Analyzer<http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/analysis/Analyzer.html>
 analyzer)
          Updates a document by merging the information in the document
containing term and the new document.

I couldn't find anything like that in 3.0.2 [1], so I assume I'll have to
implement it myself.
Is the implementation of IndexWriter.updateDocument itself a good starting
point?

Does anybody have suggestions on how to go about it? Or is it there in some
other shape or form?
Or is it absolutely discouraged?

Thanks,
Pablo

[1]
http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/document/class-use/Document.html

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message