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:-

enter image description here

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 ??

Was it helpful?

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 :

  1. In KQL : operator is similar to equals to operator whereas for Not equals to the operator is <>.
  2. Try putting ManagedProperty or its value in double quotes " if you have characters in Managed Property names like you have Risk/IssuestatusOWSCHCS
  3. 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

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top