IndexMerge Method (IndexRepository, MergeOptions)
Merges indexes from the specified index repository into the current index. Note that indexes in the repository will not be changed.

Namespace: GroupDocs.Search
Assembly: GroupDocs.Search (in GroupDocs.Search.dll) Version: 21.8.1
public void Merge(
	IndexRepository repository,
	MergeOptions options


Type: GroupDocs.SearchIndexRepository
The index repository to merge into.
Type: GroupDocs.Search.OptionsMergeOptions
The merge options.
If other indexes have a previous version, they must be updated before merging with IndexUpdater.
The example demonstrates how to merge an index repository into the current index.
string indexFolder1 = @"c:\MyIndex1\";
string indexFolder2 = @"c:\MyIndex2\";
string indexFolder3 = @"c:\MyIndex3\";
string documentsFolder1 = @"c:\MyDocuments1\";
string documentsFolder2 = @"c:\MyDocuments2\";
string documentsFolder3 = @"c:\MyDocuments3\";

Index index1 = new Index(indexFolder1); // Creating index1
index1.Add(documentsFolder1); // Indexing documents

IndexRepository repository = new IndexRepository(); // Creating index repository

Index index2 = repository.Create(indexFolder2); // Creating index2
index2.Add(documentsFolder2); // Indexing documents

Index index3 = repository.Create(indexFolder3); // Creating index3
index3.Add(documentsFolder3); // Indexing documents

MergeOptions options = new MergeOptions();
options.Cancellation = new Cancellation(); // Creating cancellation object

// Merging all indexes in the index repository into index1. Note that index2 and index3 will not be changed.
index1.Merge(repository, options);
See Also