lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Nikander <>
Subject Can I update one field in doc?
Date Thu, 28 Aug 2014 21:33:16 GMT
I tried something like this, to loop through all docs in my index and patch
a field.  But it appears to wipe out some parts of the stored values in the
document. For example, highlighting stopped working.

[ scala code ]
val q = new MatchAllDocsQuery()
val topDocs =, 1000000)
val field = new StringField(, "", Field.Store.YES)

for (sdoc <- topDocs.scoreDocs) {
   val doc = searcher.doc(sdoc.doc)
   val id = doc.get(
   var phone = doc.get(
   phone = phone + " changed"
   writer.updateDocument(new Term(, id), doc)

Should it work?  The documents have many fields and it takes 35 minutes to
rebuild the index from scratch. I'd like to be able to run smaller "patch"
tasks like this.


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