Filter SmartSearch based on URL path

Alistair DeJonge asked on September 12, 2016 18:15

I've been combing Devnet and the documentation but have not really found anything helpful. Basically I am looking for the same functionality as this page: http://www.kentico.com/customers/customer-projects, where the filters also become the the URL and visa versa.

Is this something that can be done within the transformation or the configuration of the page type/template that contains the SmartSearch Results web part? or is this something that needs to be done with Javascript?

I'm fairly new to MVC and .NET, so if it involves editing some C# code, then I'd need to pointed in the right direction for that as well.

Thank you

Correct Answer

Brenden Kehren answered on September 12, 2016 18:40

So what you do is setup your smart search index to get everything by default so you can perform dynamic filtering on it as you navigate into the pages.

For instance, say you have a URL like so:

/Partners
/Partners/USA
/Partners/Europe
/Partners/Australia

You sent your base smart search index to look at /Partners. In the webpart you configure your Path property to be a macro by clicking the black arrow and entering {CurrentDocument.NodeAliaspath%}/% What this will do is get all the pages below the current selected page. So if you're on the /Partners page, it will get all the partners below. If you're on the /Partners/USA page, it will get all the partners in USA. The key is to have your smart search set at a high level so it indexes them all so you can filter later on.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Alistair DeJonge answered on September 12, 2016 18:59

Would this require the pages to structured in such a way that all pages in the USA be under a parent page called Partners? If so, this solution wouldn't work so well.

I would like to be able to show search results based on specific field names within the page type, and have that displayed in the URL. Also be able to enter a URL with the field name and it will automatically filter based on that.

For example: I have a page type that has a drop-down field with regions in it that content editors can select from. The SmartSearch filter on the page works fine for users, but I also want the URL to show the value of the region filter as well as a user being able to put something like www.mysite.com/projects/northamerica and be taken to the Projects page with the filter automatically filtering by North America.

Does that make sense?

0 votesVote for this answer Mark as a Correct answer

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