0

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

  • 1
    Is this really the name of the Managed Property Risk/IssuestatusOWSCHCS? Looks a bit odd with a / in it AFAIK – Robert Lindgren Sep 28 '16 at 12:20
  • @RobertLindgren but this is how it is built by defualt ,i actually select it from a list of properties inside my content search web part,i did not write manually.. so not sure what i can do with this? – john Gu Sep 28 '16 at 12:22
  • Have you tried just getting all the closed items with "Risk/IssuestatusOWSCHCS=Closed". Note the equals sign rather than a colon which is a contains operator. – Matthew McDermott Sep 28 '16 at 20:41
  • @MatthewMcDermott so you are saying that "/" is not the real problem? because when i rename my managed property to be "RiskIssuestatusOWSCHCS" instead of "Risk/IssuestatusOWSCHCS" my query worked well.. and i am not writing any thing manually so not sure when i need to use "" . i am relying on the query builder windows... where i select the property and click on add... – john Gu Sep 29 '16 at 11:38
  • No, I am saying you need to test every part of the query. I do suspect that your MP name is part of the issue. Is it working now? – Matthew McDermott Sep 29 '16 at 23:06
1

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

  • i think my problem is related to having "/" inside the managed property name.. now i rename my managed property to be "RiskIssuestatusOWSCHCS" instead of "Risk/IssuestatusOWSCHCS" and my query worked well.. – john Gu Sep 28 '16 at 23:00
  • 1
    Having "/" is not the problem. Just wrap the Managed Property Name in ". I am saying it because I also tried creating exactly same site column as you mentioned and the query worked well with Risk/IssuestatusOWSCHCS as Managed Property Name – Yayati Sep 29 '16 at 3:07
  • but when i rename it i got the correct results,, it is really confusing. – john Gu Sep 29 '16 at 11:05
  • 1
    Have you to tried using "Risk/IssuestatusOWSCHCS" instead of using Risk/IssuestatusOWSCHCS ?? Because of "/" character in ManagedPropertyName, your query wasn't considering Risk/IssuestatusOWSCHCS as complete Property Name. So we have to specify it in double quotes. Renaming managed property to simple text is always going to work. – Yayati Sep 29 '16 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.