0

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.

Surendra Mourya
  • 593
  • 3
  • 8
  • 29

1 Answers1

0

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

jleture
  • 538
  • 1
  • 4
  • 11
  • I tried this option, but even this gives the same result as my old query. – Surendra Mourya Jul 21 '23 at 06:39
  • The search component is on the parent hub site or the child hub sites? Can you try with `RelatedHubSites:{Hub.Id}` in the query? – jleture Jul 21 '23 at 07:08
  • No luck, RelatedHubSites:{Hub.Id} is also giving same result – Surendra Mourya Jul 21 '23 at 07:38
  • Sorry to hear that but I just test again and it's working as expected. Without RelatedHubSites you will get results from every sites, but with RelatedHubSites you will get only results from the hub ({Hub.Id}) or the current site hub ({Hub.HubSiteId}). If the current site is the parent hub {Hub.HubSiteId} and {Hub.Id} have the same value. – jleture Jul 21 '23 at 09:11
  • Thank you @jleture, for trying this out. what you say is correct is works for me as well. The problem arises when I add RefinableString05:Bulk Data to my query. I want my search results to be filtered based documentType(crawled property) mapped to RefinableString when it is of type "Bulk Data" – Surendra Mourya Jul 21 '23 at 09:50
  • OK, I thought the hub was the only issue. I updated my solution with the `RefinableString05` filter and it's working as expected! Do you check this properties? Do you use double-quote around "Bulk Data"? – jleture Jul 22 '23 at 08:18
  • Do you finally succeed to make things working? – jleture Jul 25 '23 at 09:11
  • Yes, i got this working, in my case I needed to map crawled property and managed property for each associated sites in order to work. Initially the mapping was done only for Hub site. Thanks for your help. – Surendra Mourya Jul 28 '23 at 07:00
  • Great! Can you `accept` my solution? Thanks. – jleture Jul 28 '23 at 07:16