IndexDelete Method (String, UpdateOptions)
Deletes indexed files or folders from the index. Then updates the index without deleted paths. Note that an individual document cannot be deleted from the index if it was added to the index as part of a folder.

Namespace: GroupDocs.Search
Assembly: GroupDocs.Search (in GroupDocs.Search.dll) Version: 21.8
public DeleteResult Delete(
	string[] paths,
	UpdateOptions options


Type: SystemString
The paths to files or folders to delete.
Type: GroupDocs.Search.OptionsUpdateOptions
The update options.

Return Value

Type: DeleteResult
An object describing the result of deleting files or folders from the index.
The example demonstrates how to delete indexed paths from an index.
string indexFolder = @"c:\MyIndex\";
string documentsFolder1 = @"c:\MyDocuments\";
string documentsFolder2 = @"c:\MyDocuments2\";

// Creating an index in the specified folder
Index index = new Index(indexFolder);

// Indexing documents from the specified folders

// Getting indexed paths from the index
string[] indexedPaths1 = index.GetIndexedPaths();

// Writing indexed paths to the console
Console.WriteLine("Indexed paths:");
foreach (string path in indexedPaths1)
    Console.WriteLine("\t" + path);

// Deleting index path from the index
DeleteResult deleteResult = index.Delete(new string[] { documentsFolder1 }, new UpdateOptions());

// Getting indexed paths after deletion
string[] indexedPaths2 = index.GetIndexedPaths();
Console.WriteLine("\nDeleted paths: " + deleteResult.SuccessCount);

Console.WriteLine("\nIndexed paths:");
foreach (string path in indexedPaths2)
    Console.WriteLine("\t" + path);
See Also