We have a large number of team/project and department site collections. When the sites are provisioned each site is assigned a Team, Project, and/or Dept value in the site property bag. In some cases there may be multiple site collections that are associated with the same Team and/or Project, and so they would all have the same Team or Project property bag value. In addition, each department may have multiple Team or Project sites associated with it (similar to the Hub Site concept in SP Online, but this is SP on-prem).
We would like to define result sources for searching across multiple Team and/or Project sites, where the query would only search those Team or Project sites that have similar property bag values, so that users don't always get results from across all sites that they might have access to. I.e. we want to be able to run a search that says:
Show me all documents from all sites where property bag value "SiteTeam = Team1" or "SiteProject = Project2".
We have set up a result source that gets the current site's property bag value (e.g. SiteTeam) using the {Site.<Property>} query variable (PropBagTeam:{Site.SiteTeam} ). This query returns the expected list of sites we want to search. Unfortunately this query returns a list of sites and not a list of documents on those sites.
Is there a way to to build a query that returns documents from the list of sites that meet the criteria of the property bag value that is desired? Everything I have found for restricting the sites to search mentions using the Path variable for each site that is desired, but that requires hardcoding paths ... and this is a very dynamic scenario where the paths are different, depending on the site on which the query is run.
Does this make sense? Anyone have any ideas how to build a result source that will return documents from only the desired sites, instead of results from the full index?
Thanks