sharepoint-onlinesharepoint-searchmanaged-property

SharePoint PnP Modern search not working with refinable string for hub site


I have sharepoint online hub site and around 100 sites associated to hub site. I am using PnP modern search, I want search to work on refinablestring, it is mapped to document type which is content type choice column, Document library is created from same content type for all sites.

The problem is search do not search items from the associated sites when query template contains refinable string. I have below query

{searchTerms} RefinableString05: Bulk Data
Path:"https://dummy.sharepoint.com/sites/myHub"

I expect this to return the results from the hub site and all associated sites where my refinablestring is Bulk Data

Currently it return the results only from hub site not the associated sites, the query searches for all sites(hub and associated sites) if I remove the refinablestring

{searchTerms} 
Path:"https://dummy.sharepoint.com/sites/myHub

Can someone please help me on this, I am stuck on this for couple of days.


Solution

  • The result is the expected one. As you add a Path in your query, you will only get items with this URL. As the child hub sites have not the same URL than the parent hub, these items will not be returned.

    But there is a solution!

    You must add a RelatedHubSites with the parent hub id. This id is also available with a token {Hub.HubSiteId}. For the RefinableString05 you also have to check it in the "Selected properties" dropdown list.

    {searchTerms} RefinableString05:"Bulk Data"
    RelatedHubSites:{Hub.HubSiteId}
    

    Selected properties

    Check these articles:

    For my test: "Test Communication" is a parent hub and "Template Team" is a child hub. When searching a document "File1", only sites within the hub is returned. If I remove the filter, more results are displayed. I also added the value of RefinableString05 below the author name.

    with filter without filter without hub filter