简体   繁体   中英

IndexWriter and MergePolicy

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM