I have a site and few subsites under it. I want to exclude subsite-A from the search results, when searched from anywhere, from root or other subsites. And this excluded subsite-A should have its own search, results limited to itself.

I excluded this subsite-A using result source. Query to exclude that site from search is: {searchTerms} -Path:{Site.Path}

Now if I search something in this excluded subsite, results are empty. I think the reason is because it is excluded from search.

I am trying to figure out if SharePoint 2013 allows this? Can any one suggest me how to make this happen. Is there anyway this could be possible? Thank you.


Since you are using Path managed property, here is an example how to configure a search query to exclude a specific site from a search results:

{searchTerms} Path<>https://contoso.sharepoint.com/project

where Project is a name of site we would like to exclude.

Some more examples how to configure search query to exclude a specific site from search results:

{searchTerms} SiteTitle<>Project

{searchTerms} Site<>https://contoso.sharepoint.com/project

How to configure custom search settings for a site

  • create a Result Source (per site scope)

  • make it a Default Result Source for a site

Another option would be to create a custom search result page and set option Send queries to a custom results page URL in Search Settings

  • Can the excluded site have its own search? – smarri Jun 24 '14 at 17:00
  • Sure, first option would be to create new Result Source per site level (Site Settings - Result Sources under Search group - New Result Source) and then make it a Default Result Source for a site. Another option would be to configure custom results page per site: Site Settings - Search Settings under Search group - un-check "Use the same results page settings as my parent." and specify custom search results page url configured to specific site – Vadim Gremyachev Jun 24 '14 at 17:10
  • I used {searchTerms} -Path:{Site.Path} to root site to exclude its subsite from the search. This query woeks fine in excluding the subsite, but if I search in this excluded site, results are empty – smarri Jun 24 '14 at 17:56
  • Now I excluded the subsite by adding query in root sites result sources and unchecked "Use the same results page settings as my parent" in excluded site and added a query {searchTerms} path:path in excluded site to limit the search to itself. Will it work? – smarri Jun 24 '14 at 18:10
  • It still dint work – smarri Jun 24 '14 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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