Update Field on Many Docs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Update Field on Many Docs

Matt Hicks
I'm trying to write an efficient update to match with a Query and update all
matches with specific fields (while maintaining the other previously set fields
on each document).  I see IndexWriter.updateDocValues appears to be the closest
solution, but it takes a Term and I'd prefer to use a Query.  Is there any way
to accomplish this in Lucene without querying and updating each entry manually?
Reply | Threaded
Open this post in threaded view
|

Re: Update Field on Many Docs

Matt Hicks
Let me revise my question.  After reading through the source code for Lucene a
bit more, I realize that using updateDocValues isn't really an option.  This
leaves me with querying all the data, modifying each document, and replacing the
original.  Not as efficient as I was hoping for, but sufficient.
This does work for me, but with one major flaw.  Facets are lost because they
aren't loaded into the Document when I search.  Is there any way to retrieve the
existing facet fields into the document before I write it back out?  





On Tue, May 8, 2018 9:02 AM, Matt Hicks [hidden email]  wrote:
I'm trying to write an efficient update to match with a Query and update all
matches with specific fields (while maintaining the other previously set fields
on each document).  I see IndexWriter.updateDocValues appears to be the closest
solution, but it takes a Term and I'd prefer to use a Query.  Is there any way
to accomplish this in Lucene without querying and updating each entry manually?