using Lucene.Net.Index; // ... var indexWriter = new IndexWriter(/* index directory */); indexWriter.Merge(/* list of index segments */); indexWriter.Commit();
using Lucene.Net.Index; // ... var indexWriter = new IndexWriter(/* index directory */); var mergePolicy = new LogByteSizeMergePolicy(); mergePolicy.MaxMergeMB = /* maximum size of merged segments */; indexWriter.Config.MergePolicy = mergePolicy; indexWriter.AddDocument(/* document */); indexWriter.Commit();In this example, we create an `IndexWriter` object and set a custom `MergePolicy` to control the maximum size of merged segments. We then add a document to the index and commit the changes. The Lucene.Net.Index namespace contains the IndexWriter class. Therefore, the package library is likely to be Lucene.Net.
private Merge ( MergePolicy merge ) : void | ||
merge | MergePolicy | |
return | void |