I have a custom page in subsite(SP online site) with Search box and Search result webparts. when i try to search items, it is showing Site collection level items but i need only particular subsite items to display in result webpart.

I have tried using this property; Path:{Site.URL}

By using this without enter anything in search box some results are displaying.

Please help me how can we get search results only when we search any text in search box.


3 Answers 3


For me it worked in this syntax:

{SearchBoxQuery} Path:{SiteCollection.URL}

On that subsite go to Site Settings.

Under Search click Result Sources.

Add new Result Source (copy Local SharePoint Results).

Set name and under Query Transform open query builder.

Add Path:{Site.URL} in Query text after {searchTerms}.

Save that new Result Source and Set as default.


Had the exact same issue a few days ago.

Try Page -> Edit Page -> at your Search Results Webpart click -> Edit Web Part.

In the upshowing WebPartProperties go to "Change Query".

In your query text field enter: { ?{searchboxquery} Path:{Site.URL}}.

Worked well in my case. Maybe you wil have to change the Path to Page.URL.

Have a try.

Hope this works for you.

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.