In the public school district I work in, we use SharePoint 2013. We have a site collection (originally 2007, upgraded recently to 2013) with 1400+ subsites, each corresponding to a specific teacher or staff member.

I created an Enterprise Search Center as a subsite off the root of this site collection (/search) and was designing a Search Result Source such that when a user searches from a particular teacher's site, only items from that teacher's site or below would return.

This is the query text I used:

{searchTerms} Path:{Site.URL}

According to Microsoft's documentation at http://technet.microsoft.com/en-us/library/jj683123(v=office.15).aspx, the {Site.URL} variable returns the "URL of the site from where the query was issued." Unfortunately, that is not what seems to be happening.

When I enter a query in the search box on a given teacher's site (for example, /smithjohn) the results page in the search center returns items from the search subsite (/search), not the teacher subsite (/smithjohn).

What am I missing here to achieve the desired result?

1 Answer 1


{Site.Url} will be the URL of the site where the WebPart is, so in your case that's the Search Center.

When Microsoft is use the description

URL of the site from where the query was issued.

then it's due to them expecting you to configure a WebPart file and reuse that in many sites which without the token would require you the edit the WebPart after inserting it.

In some cases you might be able to use {Request.Referer}, but it may be to specific.

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.