NAJ
NAJ

Reputation: 1215

Kentico smart search default option

I have a smart search filter that is filtering news items by tags which all works fine.

The query for the filter dropdown is as follows:

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

I need to know how to add a default of "All" (essesntially no filter) to this list, but cannot work out how to do it.

The only option I have currently is to tag all documents with "All" tag then this would show up, but hopefully there is another way?

Upvotes: 1

Views: 437

Answers (1)

Jerreck
Jerreck

Reputation: 3020

I typically query a default of of empty string, empty string, display text and use a UNION to bind it with the set of results to actually filter by:

SELECT '','','-- Select a Value --'

UNION

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

Upvotes: 2

Related Questions