3

I have used Search Box and Search Result web part on my Home.aspx page.

enter image description here

I have added query text in search result web part, it's working fine and shows results.

But I want to hide the default result.

I want to show result only when user enter text in Search Box web part.

How can this be done?

I had tried this Article, but it will redirect to osssearchresults.aspx page.

2 Answers 2

2

Adding \\{searchboxquery?} to your Search Results Web Parts content source should work. If you are redirected to osssearchresults.aspx it sounds like you have changed the settings on the Search Box Web Part, make sure the setting; Send queries to other Web Parts on this page is checked, and your Search Result Web Part is marked as retriever.

2
  • Anders.! you are right ,I have selected option :send query to custom result page URL instead of send queries to other webpart on this page. not it's worked for me. Jul 25, 2016 at 9:23
  • it's not working for me' one file found. maybe because '\\' is text in tha file. but more than 2 '\\' work like this: '\\\\'
    – WantToDo
    Nov 26, 2020 at 14:14
0

wrap your query with {?...}
{?{searchBoxQuery} path:"<your path>" ContentTypeId:<any content type> }

see also https://thesharepointfarm.com/2016/09/customizing-the-search-control-display-template/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.