Reputation: 2113
Do we have to set the MergePolicy for IndexWriter every time an index is updated (incrementally) or is it fine if MergePolicy is set to IndexWriter only for the first time (when we are creating index)? Do subsequent updates to index have knowledge of MergePolicy if it's not explicitly set for IndexWriter?
Thanks
Upvotes: 0
Views: 410
Reputation: 9964
You have to set the merge policy for every instance of your IndexWriter.
This means that if you always re-use the same IndexWriter (which is the preferred way of updating a Lucene index), setting it once is enough, but if you create another IndexWriter instance, you need to set the merge policy again.
Upvotes: 1