Deletes indexed files or folders from the index and updates the index without the deleted paths.
Note that an individual document cannot be deleted from the index if it was added as part of a folder.
defdelete(self,paths,options):...
Parameter
Type
Description
paths
list[str]
The paths to files or folders to delete.
options
UpdateOptions
The update options.
Returns: DeleteResult: An object describing the result of deleting files or folders from the index.
Example
fromgroupdocs.searchimportIndexfromgroupdocs.search.optionsimportUpdateOptionsindex_folder="./MyIndex"documents_folder1="./documents"documents_folder2="./documents2"# Create an index in the specified folderindex=Index(index_folder)# Index documents from the specified foldersindex.add(documents_folder1)index.add(documents_folder2)# Get indexed pathsindexed_paths1=index.get_indexed_paths()print("Indexed paths:")forpathinindexed_paths1:print("\t",path)# Delete a path from the indexdelete_result=index.delete([documents_folder1],UpdateOptions())print("\nDeleted paths:",delete_result.success_count)# Get indexed paths after deletionindexed_paths2=index.get_indexed_paths()print("\nIndexed paths:")forpathinindexed_paths2:print("\t",path)
delete
Deletes documents indexed from streams or structures and updates the index without the deleted documents.
defdelete(self,options,document_keys):...
Parameter
Type
Description
options
UpdateOptions
The update options.
document_keys
list[str]
The keys of documents added from streams or structures.
Returns: An object describing the result of deleting documents from the index.
Aliases
These names call delete too, limited to the overloads listed.