Remove an article form search results (Zendesk)

Hi, I just connected our Zendesk sandbox to Algolia. I am wondering how do I remove some articles from search results?

We run a multilingual help center. Some of the articles we have on the center are not translated into other languages, mainly because the content is not relevant. All these articles with missing translation have the same title “Hide this article”. If the user enters this article they will be redirected to the original which won’t be in their preferred language. We also filtered out these article from the search results using javascript (jQuery). It worked great.

How do I prevent “Hide this article” phrase to be shown in Algoila search results? I haven’t seen any article on this topic. Is it even possible?


I’m a bit unsure about something : why are you creating those translations at all?
By default Zendesk shouldn’t generate them for you, so this means you manually created those translations, but don’t display them on your website?

If you were to set them as a draft, they wouldn’t be indexed either, but I’m not sure that’s what you want.

Hi Jerska,

The main reason is that we use generic links (with no local) to link to our support articles from outside. This way we can make sure that the user gets the support articles in their favourite language (I mean based on their browser settings). However, we run into problems if there was no translation available.

Let’s say we had an article available only in English, but user’s browser is set to Dutch. So the user ends up on 404 error page. Moreover, we know that some users switch languages while browsing the support center. They would end up on the 404 error page as well if there is no translation available.

Zendesk does not have any built-in redirect. So we developed our own solution - naming all articles with missing translation “Hide this article”, adding a little redirect script to them, publishing them, and filtering them out in the search results. It works great for us :slight_smile:

I hope I answered your question.

Thanks a lot for the explanation, this indeed helps understanding your specific issue!

In order to fit with your current workflow, you could probably add title to your index attributesForFaceting (in the Display tab of your index).
Then you’ll need to generate an API key for your indices. The procedure is described here for Shopify, but it would work the same way for Zendesk.

Here are the two main differences:

  • Instead of using FIXME_INDEX_PREFIXproducts*, you’ll need to use FIXME_INDEX_PREFIX_FIXME_HC_SUBDOMAINarticles*
    Check out your index name in the Index tab if you’re not sure

  • Instead of using inventory_quantity!=0, you’ll need to use NOT title:"Hide this article".

Finally, you’ll need to take the API key which will be generated by this script and use this one instead of the one we provided you in the small snippet of code we’ve made you add to your Help Center.

Hi Jerska, thanks for the instructions.

I am bit confused about few things. What do you mean by this:

I also checked the instructions for the Shopify. I am not sure if I got. I don’t understand how to create the “Create a file algolia_api_key.html with this content:” You can’t upload any extra html files to zendesk.

Shall I just update the code in the DOCUMENT HEAD in zendesk? That’s the place where I upladed the Algolia script snippet :slight_smile:

I think I found the Display tab (Algolia dashboard > Indices > Display > Faceting) and I added the title.

I got a little warning saying:
Unknown Attribute
We couldn’t find the attribute title in a small sample of your records; there might be a typo.

Is it something I shoudl worrry about?

I still miss the API key… I haven’t figure out this one yet.

You indeed found the right spot to add title. This warning is strange though, can you double check that you’ve correctly set them on zendesk_${YOUR_ZENDESK_SUBDOMAIN}_articles?
If it was, then let’s move forward, then see afterwards if there’s an issue.

For the script you saw, you just need to save it on your machine. Then, in your browser, you can open it using File > Open, and the API key will display on the page.

  1. Where do I check this? [quote=“Jerska, post:7, topic:1753”]

  2. Ok. I saved the file and opened it the browser, but I got an error. Any ideas what can be wrong?

At the top of the page in your Dashboard > Indices, you have a select menu.

Actually, we don’t have the $ before the {zendesk_subdomain}. I guess, I should add it, right?


I fixed the issue with title . I added to a wrong Indice (getstarted_actors) :see_no_evil:

I still get the error with the API key :frowning:


I got a new error for the API key: AlgoliaSearchError: Invalid Application-ID or API key

I copied the Application ID and Write API key (the private one) both are from the API Keys tab. Am I suppose to regenerate any of the API keys before I get the one from the local html file?

I get the same error with the Search API key (public)

Sorry for being unclear, you shouldn’t add a . Here `{YOUR_ZENDESK_SUBDOMAIN}is the whole string that should be replaced, e.g.:zendesk_algolia-test_articles`.

You need to use an Admin API key to create an API key.
You’ll need to ask the application owner to do this.

1 Like

Thanks for your help, Jerska. I made it work and generated the new API key. :tada:

I follow the Shopify tutorial. Where do I find my “theme files” I am supposed to edit?

Awesome! Now you just need to replace the one in your Document head with this new one! :slight_smile:

Thanks, it works. The code for Zendesk is much shorter. That’s why I got confused. It seems like it is eNought to only replace the old API key with the newly generated one :slight_smile:

1 Like

That’s exactly what you need to do!
Just keep the block of code that you had before, but replace the API key there with the one you’ve created, and :tada: