IndexMerge Method (Index, MergeOptions)
Merges the specified index into the current index. Note that the other index will not be changed.

Namespace: GroupDocs.Search
Assembly: GroupDocs.Search (in GroupDocs.Search.dll) Version: 20.11
Syntax
public void Merge(
	Index index,
	MergeOptions options
)

Parameters

index
Type: GroupDocs.SearchIndex
The index to merge into.
options
Type: GroupDocs.Search.OptionsMergeOptions
The merge options.
Remarks
If the other index has a previous version, it must be updated before merging with IndexUpdater.
Examples
The example demonstrates how to merge an index into the current index.
C#
string indexFolder1 = @"c:\MyIndex1\";
string indexFolder2 = @"c:\MyIndex2\";
string documentsFolder1 = @"c:\MyDocuments1\";
string documentsFolder2 = @"c:\MyDocuments2\";

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

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

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

// Merging index2 into index1. Note that index2 files will not be changed.
index1.Merge(index2, options);
See Also