Forum Discussion

mattchowell's avatar
mattchowell
Iron Contributor
Aug 10, 2022
Solved

Restrict kql search query to specific div in a page

I'm using PnP modern search web parts but the question applies to Sharepoint search in general. I'm restricting my search to published news posts but on the new post pages, there's a "recent posts" n...
  • DaveMehr365's avatar
    Aug 11, 2022

    Hello mattchowell 

     

    to restrict the query for a specific field only, you can use {searchTerms} in your query.

     

    Here is an example:

    contentclass:STS_ListItem_WebPageLibrary IsContainer<>true RefinableString101:{searchTerms}

     

    I have mapped the crawled property ows_CanvasContent1 to a managed property RefinableString101:

     

    contentclass and iscontainer are only additional parameter to specific search for pages, without template folder. You can define them according to your choice.

     

    Hope this helps.

     

    Regards, Dave