How to set up a Smart search filter for document tags

This article introduces a way how to enable a Smart search filter for document tags. The users will be able to select any of tags which belong to your site and type in the search word. Then it will find the proper results which reflect the document tags.
1. First of all, please go to: Site manager -> System tables -> edit E-commerce – SKU -> Search fields -> DocumentTags and tick the Searchable checkbox for this field. This table allows changing the searchability of standard document fields. Then please rebuild your Smart search index which you use to reflect the changes. You can ensure it in Site manager -> Administration -> Smart search.

2. Please enter a new query to CMS. You can add it for example to Site manager -> Development -> Document types -> edit Root -> Queries and insert a new query:

SELECT 'DocumentTags', TagName, TagName FROM CMS_Tag WHERE ##WHERE## ORDER BY ##ORDERBY##

and call it for example: SmartSearchFilter.

3. Then you can create or open a search page in your content tree and place these three web parts on the design tab:

Smart search filter
Smart search dialog
Smart search results

The essential settings are:

Smart search filter:
Filter mode: Checkbox
Query name: <for example: CMS.Root.SmartSearchFilter>
Query WHERE condition: TagGroupID IN (SELECT TagGroupID FROM CMS_TagGroup WHERE TagGroupSiteID = {%CurrentSite.SiteID%})
Filter clause: Must
Search web part ID: <ID of Smart search dialog web part>

Smart search dialog:
Result web part ID: < ID of Smart search results web part >

Smart search results:
Indexes: <your smart search index>
Transformation name: <for example: CMS.Root.SmartSearchResults>
Search options: none

The result will look like:

and users will be able to filter the search results by document tags.

See also: Smart search filter
Smart search overview

Applies to: Kentico CMS 5.5 R2
Share this article on   LinkedIn