How to limit searches for content to specific site collections that have the same Property Bag Value?

Rene Wagner 161 Reputation points
2021-07-20T06:23:06.92+00:00

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

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,340 questions
{count} votes

Accepted answer
  1. JoyZ 18,066 Reputation points
    2021-07-21T08:50:27.687+00:00

    @Rene Wagner ,

    Per my test, the property bag of the site in search result source will only return the site, not contents in the site.

    In other words, if the site meets this property, the site will be displayed in the search results, however the documents in the site do not have attributes like SiteTeam, so we cannot meet both requirements at the same time.

    That's why we could not search all documents based on dynamic site property that are satisfied.


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.