Merges the specified index into the current index. Note that the other index will not be changed.
publicvoidMerge(Indexindex,MergeOptionsoptions)
Parameter
Type
Description
index
Index
The index to merge into.
options
MergeOptions
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.
stringindexFolder1=@"c:\MyIndex1\";stringindexFolder2=@"c:\MyIndex2\";stringdocumentsFolder1=@"c:\MyDocuments1\";stringdocumentsFolder2=@"c:\MyDocuments2\";Indexindex1=newIndex(indexFolder1);// Creating index1index1.Add(documentsFolder1);// Indexing documentsIndexindex2=newIndex(indexFolder2);// Creating index2index2.Add(documentsFolder2);// Indexing documentsMergeOptionsoptions=newMergeOptions();options.Cancellation=newCancellation();// Creating cancellation object// Merging index2 into index1. Note that index2 files will not be changed.index1.Merge(index2,options);
If other indexes have a previous version, they must be updated before merging with IndexUpdater.
Examples
The example demonstrates how to merge an index repository into the current index.
stringindexFolder1=@"c:\MyIndex1\";stringindexFolder2=@"c:\MyIndex2\";stringindexFolder3=@"c:\MyIndex3\";stringdocumentsFolder1=@"c:\MyDocuments1\";stringdocumentsFolder2=@"c:\MyDocuments2\";stringdocumentsFolder3=@"c:\MyDocuments3\";Indexindex1=newIndex(indexFolder1);// Creating index1index1.Add(documentsFolder1);// Indexing documentsIndexRepositoryrepository=newIndexRepository();// Creating index repositoryIndexindex2=repository.Create(indexFolder2);// Creating index2index2.Add(documentsFolder2);// Indexing documentsIndexindex3=repository.Create(indexFolder3);// Creating index3index3.Add(documentsFolder3);// Indexing documentsMergeOptionsoptions=newMergeOptions();options.Cancellation=newCancellation();// 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);