Forum Discussion
Sharepoint search box web part - results only current site
Path:{Site.URL}
Hi Brent Ellis,
Does that work?
Isn't Site.Url using the Site of the search results web part? Therefore If all search boxes on many sites all need to lead to the same search results page then that wouldn't work. you would get results from where the search result page has been created.
- Brent EllisJan 10, 2017Silver ContributorAh thx, missed that point, ya, we have always resorted to hard-coding the Paths and -Paths, and using the QueryStrings like Peter mentioned, less trouble than its worth.
- Mike JansenJan 11, 2017Iron Contributor
Part 2 ;-)
Solved it but, a bit strange, I think.
Like mentioned I've changed the results page url like this:
https://mytenant/sites/test/sitePages/results_test.aspx?u={contexturl}&mypath='https://mytenant/sites/test/customer500/case1'
I did not do anything with the "mypath" variable anywhere. Even not in the result source.
I'm not a big fan of solutions that suddenly work, without knowing why ;-)
Can someone explane why this seems to work?
- Jan 11, 2017
- Mike JansenJan 10, 2017Iron Contributor
Pieter Veenstra wrote:Hi Brent Ellis,
Does that work?
Isn't Site.Url using the Site of the search results web part? Therefore If all search boxes on many sites all need to lead to the same search results page then that wouldn't work. you would get results from where the search result page has been created.
Indeed my experience as well