0

I want to create a query for a search results that is the same as the default one, in that it only returns things in the particular section of the site it is in. Does anyone know what this query would be if I was to create it myself? I'm using SP2013, I have tried using Path:{Site.URL} when in Snippet Gallery but that uses the site that my results page is in

  • SP2010 or SP2013? – Max Melcher Jul 22 '14 at 9:48
  • it is for SP2013 – bimbob Jul 22 '14 at 9:49
0

The standard query for everything is (w/o people results) is:

{?{searchTerms} -ContentClass=urn:content-class:SPSPeople}

So if you want a "this site only" scope you should add the url as filter either with

path:"http://hostname.fqdn/sites/site1"

or with a Query Variable

path:"{site.url}"

You can see the substitutions in the query builder wizard in the "TEST" tab.

  • What if I am using this page for multiple sites? as site.url will only do it for the page the search results is on – bimbob Jul 22 '14 at 10:06
  • add multiple path properties: path:hostname.fqdn/sites/site1 path:hostname.fqdn/sites/site2 ... SharePoint will OR-join the results. – Max Melcher Jul 22 '14 at 11:51
  • I only want it to search the site I am in. so say I have to site hi and bye. When I use the search for hi it only return things in hi and the same for bye – bimbob Jul 22 '14 at 12:37

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.