SharePoint 2013: Avoid default results in search result and content search web part with search box
Hi Friends,
I faced one more issue recently related to SharePoint 2013 search, that I thought to share with you.
Scenario:
I have ‘Search Box’ web part and ‘Content Search’ web part on a page, search box is sending query keyword to content search web part to display results. Content search web part has couple of additional queries as following screen shot showing.
This query returning the results always and thus showing me the results before even started searching using search box web part, as shown in following image.
I wanted content search web part should show the results only when someone searches for it in search box, else results should not be displayed.
Solution:
I have modified the Content Search web part’s query like following, which given the expected results.
So after the query changes by default no results are displayed and I am getting results only when I searched using search box web part, as shown in following images.
The same changes will be applicable if you are using search results web part.
Hope this article will helpful for some of our friends, if any other good alternative for this found please let me also know about it.
Just i was looking for, thanks guy !
Thanks for sharing this. It works perfectly!!
Thanks a lot!
I know this post is quite old, but I wanted to say thanks anyway because it helped me as well. I am now trying to figure out how to eliminate the generic “Nothing matches your search” message that is still being displayed when a user goes to the page. In case this comment is being read, any help would be greatly appreciated. Thanks!
Thanks.
Thanks very much it saved my time
Nice article sir..
you have save my day..
Thank You..
Thanks alot
Thanks
Just recently this resolution resulted in no results found for my custom result source. I had to remove the // to have the search results show up again. Now I have the orig problem of results showing by default. Anyone else experience this?
Hi have you got any solution to your problem. I am facing same issue. Adding
\\{SearchBoxQuery?} dont show nay results after entering search as well.and removing it shows bunch of default result which I dont want.
Almost 5 years later and I needed this today. Fixed my issue. Thanks!
Hello. The solution works fine with \\{{SearchBoxQuery?} and with search values like “john*” but the search doesn’t return any value when the search text is “*”. I have to mention that I have defined other filter values in the Search condition:
\\{SearchBoxQuery?} Department:I*
Thanks for your help.