Archive
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.