Can not filter my Search results inside my Search Content WebPart based on a Dropdown site columnvalue
-
09-12-2020 - |
Question
I have a site column named Risk/Issue status
which is of type drop down and have multiple values, such as; Open, Closed, In Progress, etc.., as follow:-
now i want to define a search query inside my Search content web part, to show all the items that have their status != closed
. so i try the following criteria, but it did not work:-
path:"http://servername/sites" (IsDocument:"True" OR contentclass:"STS_ListItem") EscalatedOWSCHCS:Yes -Risk/IssuestatusOWSCHCS:Closed
now when i run the query the result will not show any thing..although i have many items which are In Progress
, On hold
, etc. so not sure what is wrong in my case?? now if i remove -Risk/IssuestatusOWSCHCS:Closed
i will get all the items , but i am not sure how to exclude the items which have their status = closed
??
Solution
The query usually used in Content-Search-Web-Part
is called KQL (Keyword Query Language).
So there are three things which I want to highlight here :
- In KQL
:
operator is similar toequals to
operator whereas forNot equals to
the operator is<>
. - Try putting
ManagedProperty
or its value in double quotes"
if you have characters in Managed Property names like you haveRisk/IssuestatusOWSCHCS
- Try separating multiple conditions with space or additionally wrapped in round brackets
()
So keeping above mentioned things in mind, your query should be like this.
path:"http://servername/sites" (IsDocument:"True" OR contentclass:"STS_ListItem") (EscalatedOWSCHCS:Yes) ("Risk/IssuestatusOWSCHCS"<>Closed)
For more info on KQL, please go through this MSDN Article