I’ve a blog site where 20+ categories are there.Now my requirement is using content search webpart I have to fetch some specific categories post using search query. Only posts out of specific categories shall be displayed in a sitepage. Now all categories results are coming.. I tried to filter by category ID or name, but no success.

categories link like: blogs/Events/Lists/Categories/Category.aspx?CategoryId=3

Any ideas on how to exclude the specific category using query?

Thanks in advance


For your requirement, you can do as the followings:
1. Go to SharePoint Admin Center->Search->manage search schema
2. Find a free RefinableStringXX managed property like RefinableString00
3. Map ows_PostCategory into it:
enter image description here

  1. Wait for the online search crawl, maybe you need to wait for 24hrs
  2. Go to the Content Search web part, then you can set the query string like:

    path:"http://xxx/Blog/Lists/Posts" contentclass=STS_ListItem_Posts -RefinableString00: yourcategory enter image description here

Similar thread for your reference:Searching Blogs on SharePoint Online

  • Thanks a lot.. But Can give me some idea about how to achieve the same for Mordern experience sharepoint ?? – Rajrup Bhattacharya Aug 15 '19 at 13:49
  • Hi Kally.. I have done all the steps what you mentioned but still I am not able to filter out the category from search results. and I am not getting CustomPostCategory in property filter section.. What to do for that ?? – Rajrup Bhattacharya Aug 19 '19 at 6:55
  • it should be your managed property which is mapped to ows_PostCategory(RefinableString00) instead of CustomPostCategory that I just used to test. I updated my answer. – Kally_MSFT Aug 19 '19 at 7:23
  • I tried the same but no luck.. Do you want me to share what I did ? – Rajrup Bhattacharya Aug 19 '19 at 7:49
  • Have you tried as Step 1 to Step5? – Kally_MSFT Aug 19 '19 at 8:35

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.