Forum Discussion
Sharepoint search box web part - results only current site
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.
- 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 12, 2017Iron Contributor
In advanced mode:
"path:"https://banninglaw.sharepoint.com/sites/test" (FileExtension:doc OR FileExtension:docx OR FileExtension:xls OR FileExtension:xlsx OR FileExtension:ppt OR FileExtension:msg OR FileExtension:pptx OR FileExtension:pdf) (IsDocument:"True" OR contentclass:"STS_ListItem")"
Nothing magic here. The result source is just the "documents" result source