Deletes indexed files or folders from the index. The deleted documents are excluded from search immediately and are physically removed from the index when the index is optimized with Optimize. Note that an individual document cannot be deleted from the index if it was added to the index as part of a folder.
An object describing the result of deleting files or folders from the index.
Exceptions
exception
condition
ArgumentNullException
The paths or the update options are null.
ObjectDisposedException
The index is disposed.
Examples
The example demonstrates how to delete indexed paths from an index.
stringindexFolder=@"c:\MyIndex\";stringdocumentsFolder1=@"c:\MyDocuments\";stringdocumentsFolder2=@"c:\MyDocuments2\";// Creating an index in the specified folderIndexindex=newIndex(indexFolder);// Indexing documents from the specified foldersindex.Add(documentsFolder1);index.Add(documentsFolder2);// Getting indexed paths from the indexstring[]indexedPaths1=index.GetIndexedPaths();// Writing indexed paths to the consoleConsole.WriteLine("Indexed paths:");foreach(stringpathinindexedPaths1){Console.WriteLine("\t"+path);}// Deleting index path from the indexDeleteResultdeleteResult=index.Delete(newstring[]{documentsFolder1},newUpdateOptions());// Getting indexed paths after deletionstring[]indexedPaths2=index.GetIndexedPaths();Console.WriteLine("\nDeleted paths: "+deleteResult.SuccessCount);Console.WriteLine("\nIndexed paths:");foreach(stringpathinindexedPaths2){Console.WriteLine("\t"+path);}
Deletes documents indexed from streams or structures. The deleted documents are excluded from search immediately and are physically removed from the index when the index is optimized with Optimize.