How do I exclude a directory from a search result?

You can exclude directory from search results by adding exclude rules in your console. If you want to exclude a specific directory then select either the dir1 or dir 2 field, set it to 'Equals', and then enter the directory name that you wish to exclude from search results.

For example, if you have a site called www.acme.com with a section containing legacy publications you wish to exclude at www.acme.com/old, you would create an exclude rule where 'dir1' equals 'old-directory'. This will remove all content from the index found within 'old'.

If the content instead lived in www.acme.com/publication/old then you would set the rule where 'dir2' equals 'old'.

How to hide a field in a search interface?

Background

When you generate an interface via console for a Site Search collection, we return title, description, URL, and image(optional) in the search results. In some instances, you might want to hide title, description, or URL.

Limitation

Our default interface uses URL field for click-tracking, and it must be returned in response, otherwise, the click-tracking won’t function. Hence, if you try to remove URL field, it will return an error:


tracking field 'url' missing from result.

Instructions

To hide ‘title’ or the ‘description’ field from the search interface:

  1. Generate an interface from the Integrate section in the console.
  2. After choosing the relevant options, and generating an interface, click on “View code“
  3. Add the “fields” parameter in the values object. See example below which will only return and render ‘title’ and ‘URL’:

values: {"q.override": true, "resultsPerPage": "10","q": getUrlParam("q"), "fields":'title,url'}