If you have a Coveo Search Box and are using the Query Suggestions model, then at some point in time you're likely to find a suggestion being returned that you'd like to remove. Maybe even if you're doing testing, in preparation for a launch, you'll see a term or two that you wish wasn't in the list. So how do you remove it?
First thing first is to download the list of existing "blocked" terms.
We do that using the Platform API's Advanced Model Configurations methods. Specifically, the
GET method for the
configurationType with value
BLOCKLISTS as shown below.
Like other API methods, you'll need to ensure you've clicked the
Authorize button prior to using it to grant you access.
You will also need the
organizationId and the
modelId. The Org Id can be obtained via the URL and the Model ID from the Query Suggestion model ID page from within the Platform Admin.
When you download the initial
BLOCKLISTS file you are most likely to receive a 404 response. This is because the file is empty. It's important to download the one that's being used as we must add to it if it exists.
Each Query Suggestion we want to "block" should be on a separate line. For example:
Now that we've got a text file with the term(s) we want to 'remove", we need to upload it into the model itself. So we're going to use the
PUT method to do so.
If everything is done properly you will receive a 200 response. You can then go back up to the
GET method and re-run it and download the file to ensure your terms have been accepted.
So that you are aware, it can take several hours before the term has been removed from the model, so don't go expecting it to disappear right away.
Sign up to our bi-weekly newsletter for a bite-sized curation of valuable insight from the Sitecore community.