How to smart search filter by path

Kayla Johnson asked on November 1, 2017 15:15

I'm setting up smart search for our client site. And they want to filter by Path, since there are 3 major, what they are calling "Categories" that documents can be in.

https://pasteboard.co/GRDE1FG.png

;;Category Our-Company;Our-Company;Our Company Resources;Resources;Resources Departments;Departments;Departments

I have my options set in the smart search values. But I don't understand the documenation enough to know what to do with these to filter by Path. Also when I submit the search it's adding category=# to the url query string, rather than something like category=Our-Company. I'm not sure if this is how the filter works.

(as an unrelated note you can see it's adding a comma to the start of the search term when you come from the search in the top nav....)

Correct Answer

Trevor Fayas answered on November 2, 2017 20:09

Thanks for the Configuration Screen Shot.

For your Values, you want to remove the + as that's auto-added by the "Filter is Conditional", and you want to check "Filter is Conditional"

Next you have a value of "/Our-Company/%" , % is not a wild card in Lucene searches, you want to use the * character, so "/Our-Company/*"

So the end should look like:

;;Category
nodealiaspath;"/Our-Company/*";Our Company
nodealiaspath;"/Resources/*";Resources
nodealiaspath;"/Departments/*";Departments

And check "Filter is Conditional"

0 votesVote for this answer Unmark Correct answer

Recent Answers


Trevor Fayas answered on November 1, 2017 20:33 (last edited on November 1, 2017 20:35)

In the Lucene records, it contains a nodealiaspath field, you should be able to filter by:

+nodealiaspath: "/news/*"

the + means the result has to have it, the nodealiaspath is the field, and the value is the thing that has to match, and the * is a wild card.

Here's a listing of fields you can find, a great tool to check your syntax and values is called Luke

Kentico Fields

1 votesVote for this answer Mark as a Correct answer

Kayla Johnson answered on November 1, 2017 23:32

I dont understand. Where do I put that value in the web part?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 2, 2017 10:42

Hi Kayla,
You add the value either as a Search condition in the search results web part configuration or, if you are using search filters, then you will add this value as one of the filtering option. Also, smart search syntax docs may be helpful.

1 votesVote for this answer Mark as a Correct answer

Kayla Johnson answered on November 2, 2017 19:50

I have read the documentation and I don't understand it. That's why I'm here.

https://pasteboard.co/GROTB16.png

This is my filter settings. I don't think it's right. I'm not understanding where I'm supposed to put the filter text. Whatever I put before the first semicolon is what goes for the value of the < option > in the dropdown on the front end. And that's not right. Any time I search it's pulling back all results and setting &category=1; in the URL.

0 votesVote for this answer Mark as a Correct answer

Kayla Johnson answered on November 2, 2017 20:32

Thanks for your help so far. It's getting closer. It's still not working. It's pulling all Documents. I know the web parts are synced up because if I do change it and manually added the + before nodealiaspath just to test, it broke and pulls nothing.

But with the settings above, it shows all documents regardless of the selected option. Is it an issue that the query string is &category=2; with the semi colon? Is it supposed to be a number?

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on November 2, 2017 21:07

Not sure on the semicolon, but the URL parameter only selects the "index" of the filter, so 2 would be the 3rd option i believe (unless it isn't 0 based index, forgot).

Did you try that Luke tool? It can help you to see what values you have and test out filter search values, first make sure +nodealiaspath:"/Resources/*" works normally.

0 votesVote for this answer Mark as a Correct answer

Kayla Johnson answered on November 2, 2017 21:11

I dont understand what to do with the Luke files. I don't have access to the file system for this site. I'm working strictly in the web interface.

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on November 2, 2017 21:17

Ah, then Luke won't help ya, you do need access to the files...

Try without the quotes maybe? Not positive if it natively wraps these.

;;Category
nodealiaspath;/Our-Company/*;Our Company
nodealiaspath;/Resources/*;Resources
nodealiaspath;/Departments/*;Departments
0 votesVote for this answer Mark as a Correct answer

Kayla Johnson answered on November 2, 2017 21:41

I did figure it out. I guess you need to specify the Filter Clause option in the dropdown. I set it to must and now it works.

0 votesVote for this answer Mark as a Correct answer

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