Insights

How To Remove Unwanted Query Suggestions From A Coveo Search Box

When Do You Need To Remove A Query Suggestion?

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?

Surprisingly easy!

Using The Coveo Platform API

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.

BLOCKLISTS configuration Type using the GET method in Coveo

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:


Harry Potter
Testing
Calgary

Upload The New Blocklist

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.

Uploading new BLOCKLISTS using the PUT method in Coveo

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.

👋 Hey Sitecore Enthusiasts!

Sign up to our bi-weekly newsletter for a bite-sized curation of valuable insight from the Sitecore community.

What’s in it for you?

  • Stay up-to-date with the latest Sitecore news
  • New to Sitecore? Learn tips and tricks to help you navigate this powerful tool
  • Sitecore pro? Expand your skill set and discover troubleshooting tips
  • Browse open careers and opportunities
  • Get a chance to be featured in upcoming editions
  • Learn our secret handshake
  • And more!
Sitecore Snack a newsletter by Fishtank Consulting
 

Meet David Austin

Development Team Lead | Sitecore Technology MVP x 3

📷🕹️👪

David is a decorated Development Team Lead with Sitecore Technology MVP and Coveo MVP awards, as well as Sitecore CDP & Personalize Certified. He's worked in IT for 25 years; everything ranging from Developer to Business Analyst to Group Lead helping manage everything from Intranet and Internet sites to facility management and application support. David is a dedicated family man who loves to spend time with his girls. He's also an avid photographer and loves to explore new places.

Connect with David