I'm using Content By Search WebPart to list Announcements from different site collections.

By using below query I'm able to show announcement items from different site collections.

path:"http://spdev:XXXX/sites"  ("STS_ListItem_Announcements")

In my announcement following field present:

Title        Single line of Text

Department   Single line of Text

Body         Multi line of Text

Global       Check Box

My requirement is to show only Announcement item which Global as Yes. (If I tick the value it show in list as "Yes" if i not selected it show as "NO" ) b

By using below query I'm able to select announcement which are related to Department Admin

path:"http://spdev:xxxx/sites"  ("STS_ListItem_Announcements") Admin 

If I enter Yes in the query no result is retrieved.

path:"http://spdev:xxxx/sites"  ("STS_ListItem_Announcements") Yes 

How to use checkbox value in query string?

  • I guess you didn´t even think of reading Microsofts Explanation for the KQL-Syntax?? (KQL stands for Keyword-Query-Language). – Leopold Lerch Aug 31 '15 at 13:26

First of all always good to avoid hard coded urls, so instead you can use Path:{SiteCollection.URL} or Path:{Site.URL} depending on your need.

Now if your Global field is a site column , then there will be a managed property created by the name GlobalOWSBOOL . You can go to Search Schema and check if it exists otherwise you can create a new managed property and map it to this column and make it searchable and queryable. So once you have it ready your final query should look like something below:

Path:{SiteCollection.URL} AND ContentType:0x0104* AND GlobalOWSBOOL=1 

Note:0x0104* is for all announcements.

| improve this answer | |
  • ContentType:0x0104* Not working for me – Gurunathan Sep 1 '15 at 10:50

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.