Your problem

For a long time I’ve been trying to restrict a query within my SharePoint Search Result web parts to items in a list within my current site.

Including Path:{Site.Url}/MyList doesn’t seem to do the job. When I’ ve got sub sites which also include lists called MyList then I’m simply getting results from all sub sites as well.

My Solution

Then I stumbled across the following article:

https://technet.microsoft.com/en-us/library/jj683123.aspx

It mentioned the option of escaping the variables. So I included the following in my query:

Path:{\Site.Url}/MyList

And now I’m getting the right results returned.

Advertisements