smart search filter values

Farah El Agha asked on November 8, 2017 14:31

hello guys, I want to filter the smart search results by path and I am using the following values:

;;All

nodealiaspath; "/2017/"; 2017

nodealiaspath; "/2016/"; 2016

ALL is returning the values correctly but the others options are not returning anything. what could be the problem. Filter clause is set to Must and filter is conditional is checked.

Correct Answer

Brenden Kehren answered on November 8, 2017 16:18

Check out the documentation for more specifics on the syntax.

  • Regarding the "+" yes you can remove that.
  • The proper syntax for a field name search is <fieldname>,<value>,<display text>. So in your case, leave the nodealiaspath as a static string.
  • The query I posted returns the values I showed in my previous answer:

+nodealiaspath,'/who-we-are/blog/march-2017/*,'March 2017'
+nodealiaspath,'/who-we-are/blog/february-2017/*,'February 2017'
+nodealiaspath,'/who-we-are/blog/January-2017/*,'January 2017'

So yes, /who-we-are/blog/march-2017/* is a path. It's similar to your scenario. If you want to get all the pages from under /news/2016 your path in a repeater would look like /news/2016/%. For smart search you need to pass in that path but replace the % with *.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on November 8, 2017 15:17

Just implemented this for the Blog Months using a query:

SELECT '+nodealiaspath', '/who-we-are/blog/*', '-- select a month --'
UNION
SELECT '+nodealiaspath', NodeAliasPath + '/*', NodeName
FROM View_cms_Tree_Joined
WHERE NodeAliasPath like '/who-we-are/blog/%'
    AND ClassName = 'CMS.BlogMonth'

You can see the first SELECT is the ALL selector and displays all the blog posts under the blog path and looks like this when rendered:

+nodealiaspath,'/who-we-are/blog/*,'-- select a month --'

The other values look like so:

+nodealiaspath,'/who-we-are/blog/march-2017/*,'March 2017' +nodealiaspath,'/who-we-are/blog/february-2017/*,'February 2017' +nodealiaspath,'/who-we-are/blog/January-2017/*,'January 2017'

I think your missing piece is the wild card after the forward slash for the year.

0 votesVote for this answer Mark as a Correct answer

Farah El Agha answered on November 8, 2017 16:06

just to make things clearer I have a couple of questions:

  • the "+" sign can be removed if we set filter is conditional?
  • the nodealiaspath is a fixed name representing the path, so I dont need to replace it by a variable from database (from from search results transformation) right?
  • '/who-we-are/blog/January-2017/* is what exactly? the path with the blogs tree?
1 votesVote for this answer Mark as a Correct answer

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