Example 1: Hide a Document Based on Its URL

This article walks you through the steps of hiding a document based on its URL. What is true of the URL field is applicable on other fields as well so that if you learn how to remove from results a document with a specific URL, you will also learn how to remove documents based on their Title, Description, Tag, and any indexed field. For illustration, we hide the top result from a Salesforce Communities search client.

  1. Because the top result is from a StackOverflow content source, open StackOverflow 30K (label could be different in your instance) and then Question.

  2. Click Create Formula.

  3. Because the goal is to hide a document based on its URL, we have to drag the field storing web addresses to the gray area. In our case, the field is view_href.

  4. In the dialog that has appeared, copy the document URL (the one that is to be removed) into Response. Give this activity a name in Action Name and click Save.

  5. Now that we have stored data (web address) in a field (view_href), the next task is to decide what to do with the data. For that scroll down to Formula Field Mapping. To hide a document based on a field value, select NOT from the Operators dropdown. NOT() will appear inside the gray box.

  6. Move cursor by one to the left so that it's between the parenthesis of NOT() and then pick an Action Name from List of Formula

  7. Save your settings.

Refresh the page.

Example 1 Notes

  • It's possible to create complex visibility conditions using the other operators: AND, OR, and REGEX. For instance, you can write a formula of the type AND(URL1, URL2, URL3, NOT(URL4 OR URL5)) which translates into: Show all of URL1, URL2, and URL3 but not URL4 and URL5.
  • AND and OR are Boolean but REGEX interprets the value in Response as a regular expression. NOT(REGEX(Exclude_StackOverflow)) hides all the documents hosted on StackOverflow. (This Formula assumes that the admin has used the correct regular expression to exclude StackOverflow documents in Action Exclude_StackOverflow.) 

Last updatedFriday, September 22, 2023

Or, send us your review at help-feedback@searchunify.com