Smart search filter default "All" option

Nicole Johnson asked on January 14, 2015 12:22

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?

Correct Answer

Nicole Johnson answered on January 15, 2015 09:36

I got the answer from stack overflow:

SELECT '','','All'
UNION
SELECT 'DocumentTags', TagName, TagName FROM CMS_Tag WHERE ##WHERE## ORDER BY ##ORDERBY##
0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on January 14, 2015 14:19

Update your query to use a UNION

SELECT 'DocumentTags', 'All', 'All' 
UNION
SELECT 'DocumentTags', TagName, TagName FROM CMS_Tag WHERE ##WHERE## ORDER BY ##ORDERBY##
1 votesVote for this answer Mark as a Correct answer

Nicole Johnson answered on January 14, 2015 15:03

Thanks Brenden, It now has the option All in the list, but it doesn't return any results when it should be returning everything.

Do you know what I am doing wrong?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.