My organization built an intranet in the root site of the root site collection. Currently, using the search function in the site pulls all results from our entire SharePoint environment. We'd like to limit search results to only the contents of that site, blocking out results from any sites below the root site collection. I understand why it does this, since all SharePoint items include the root address in their path.

Research has led me to believe query rules are the answer, and have tried this query rule at the site level to exclude results from anything below the root site collection:


While the test of the query appears to behave appropriately, live search does not; all results still display. Is there a quirk to query rules at the site, or could this have something to do with the fact that we're running search using the modern/non-classic experience?

1 Answer 1


I would not use Query Rules. You have two options that will effectively remove the additional sites. The first is to simply secure the sites you do not wish people to see in search results with appropriate permissions. If they do not have access to the sites, they will not see the content. That is how "Security Trimming" works. Your second option is to change the default Result Source to include the additional query parameter -Path:https://[orgname].sharepoint.com/sites/* The thing to remember is that your users can still access the sites and information in these sites, they just cannot search for it.

Also, if your users are knowledgable, they can create a search page that does not use your result source and easily find the content you are trying to "hide".

The best option is "security" and it is simple.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.