I am trying to search all sites and subsites under a site collection. But I am unable to get all the sites in the result by (contentclass:STS_Site OR contentclass:STS_Web) . If I search the site with the name, the result shows the site.

I went through various blog, but couldn't find the proper solution.

1 Answer 1


A Site Collection doesn't have dependency to another Site Collection. Only Web have dependency to it's Root web and Site Collection.

To receive all Site Collections and Webs, you need to lose the OR statement and type

(contentclass:"STS_Site") (contentclass:"STS_Web")

To narrow down the result of sites, and not show all sites, you can add the path variable on one or both of the expressions.

(path:http://mySiteCollection/ contentclass:"STS_Site") (contentclass:"STS_Web")

You have to try different expressions to receive what you really want to show.

  • Thank you for your reply @benny . I tried by removing OR statement it didn't work. It showed the same number of results. i.e. 13 results, whereas my sitecollection has 32 1st level sites. Apr 26, 2017 at 13:44
  • @RagingRiver Are you sure the other sites are crawled without errors? You can check this in Central Admin > Manage Service Applications > Search Service Application > Crawl Log
    – Benny Skogberg
    Apr 26, 2017 at 14:10
  • Yes. All the sites are crawled. When I search wit the site name I get the site. But using contentclass , it does not. I read somewhere in blogs that it might be due to definition of the site template. Not sure though. It stated that site based on publishing site template and custom templates are not returned in a search via (contentclass:STS_Site OR contentclass:STS_Web). Also, I would like to convey that I am working on SharePoint Online. Thanks for your help @benny Apr 27, 2017 at 7:39
  • I'm also struggling with this. There is next to no documentation anywhere about the search queries. I need to find what associated sites there are under a hub site. That's all. But it's nigh-on impossible. Mar 27 at 9:10

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.