Deleting Search Collections

The search-collection-delete function (SearchCollectionDelete in the C# SOAP API) function enables you to delete a search collection by name, and also deletes all files on your disk or other storage medium that are associated with that collection.

In order to delete a search collection, you must first ensure that the crawler and indexer for that collection are stopped. The easiest way to do this is to pass an optional Boolean parameter with a value of true as the second argument to the search-collection-delete function. If this parameter is true, this causes the function to terminate all services associated with that collection before deleting the collection. If you do not pass a value for this second parameter, a value of false is used for that parameter.

Alternately, if you want to be able to determine exactly when you can safely delete a collection, you can terminate any associated crawler and indexer services manually before calling the search-collection-delete function. When terminating associated services manually, you must terminate the crawler first, so that it does not accept additional enqueue requests that might cause it to restart the indexer, and then terminate the indexer. See Stopping the Crawler Service and Stopping the Indexer for more detailed information. The crawler and indexer will not stop immediately, but you can check the status of the search collection to determine when they have actually stopped. See Retrieving Search Collection Status for more information.

Once all services associated with a collection have stopped (or if you specify true as a second paramater to the function), calling the search-collection-delete function with the name of a collection will delete the node for that collection from the Watson Explorer Engine repository and will also delete all files that are associated with that collection.

In C#:

    this.searchCollectionStopServices();
    
    SearchCollectionDelete del = new SearchCollectionDelete();
    del.collection = COLLECTION;
    port.SearchCollectionDelete(del);

In addition to the optional second parameter that determines whether the services associated with a collection should be terminated automatically, the search-collection-delete function also takes an optional third parameter, also Boolean, that forces the delete operation to complete and return success even if the node for that collection is not found in the repository. If you do not pass a value for this third parameter, a value of false is used for that parameter. Specifying the force parameter can be useful if a previous collection move or copy operation did not complete successfully, or if the Watson Explorer Engine repository is in an inconsistent state. Symptoms of inconsistent collection or repository state are when a collection delete operation that does not specify this paramater fails, and a collection create operation also fails.

Note: Specifying the force parameter cannot resolve every collection-related inconsistency. For example, if the repository entry for a search collection was deleted while services associated with that collection were still running, there is no way to stop those services without stopping and restarting Watson Explorer Engine. Similarly, if non-default directories were configured and used for crawling and indexing, these will not be removed if the collection node cannot be found.