Forum Discussion
Result page for Search box
Hi there,
I hope someone can help me. I need to build a simple search, where what ever is typed in search box, is just entered as-is after the results page URL i have set.
So i have a results page URL called: "http://....../.../search/" and i just want the sharepoint search box to place the text from the search box after this URL. So if the user searched for "Amsterdam", the search box should build this results page URL: "http://...../.../search/amsterdam"
how do i do that ?
3 Replies
- spucelik
Microsoft
Jesper...you can accomplish this with a Content Search web part and the KQL query provided. Here are the steps I used to repro the solution:
- Create a new Web Part Page.
- Add the Search Box and Content Search web parts to the page.
- Make sure the Search Box results are pointing to the Content Search web part. It should do this automatically.
- In the properties of the Content Search web part -> Change Query button -> Advanced View to see the KQL editor.
- Paste in this KQL: "path: http://....../.../search/{SearchBoxQuery}"
- Save and test.
Assumptions:
- When the user types in something in search box, whatever they type in will get appended to the end of the "path" url in the KQL search string.
- In my testing whatever I typed in the search box was a site that I wanted to focus my search to.
- In your example I assumed amsterdam was the name of a site you wanted to focus your search results to.
- The Content Search web part will return results specific to the "path" in the KQL query.
Hopefully this is what you're looking for.
Steve- Jesper Torp LassenCopper Contributor
Hi Steve :-)
Thanks very much for this, but it didnt quite help me, and that might be my fault not explaining correctly. I would like the result to be the browser opening a new page, with URL build by the URL+{search box input}
- Matt WestonIron Contributor
As far as I know that's not something which can be done with the search box. The behaviour is that the search query is appended as query string parameters i.e. ?q=Amsterdam
Your main option would be to create your own control which will format the URL as you specifically need.