Limit Search Results to the current and child site in SharePoint 2013

Here is a quick tip for the use case where you want to limit the results of a search to only search within the site you are on and/or its sub sites:  

  1. Create a result source at whatever level you wish. If you set it at the search service level, you can use this results source over and over throughout the entire farm. It can also be set for a site collection or an individual site. You need to figure out at what level do you want to reuse it. Just copy the default result source and modify it as follows.
  2. Use the query transform capability to modify the results source by adding the following modification. Add the property path contains “This site”. It will look like this in the query text:
  • Path:{Site.URL}

Since you are specifying “contains”, it will include the current site and all subsites since all subsites will contain the path of the parent. All other results not in or below the current site will be excluded because they will not have this path.

The screen shot below shows the configuration of this change at the site collection level. If we had made this change at the farm (search service) level, it can be used anywhere in the farm. 


About Bluespring

Bluespring is a software development arm of Ascendum Solutions with a singular focus on helping organizations make work flow in Microsoft SharePoint.  We provide software and services that boost an organizations use of SharePoint to get critical information to the right people at the right time ... Read More

Stay Posted

Stay Posted

Sign up to receive the latest updates via email:

View Our Brochure

Download it Now