Archive

Archive for August, 2013

SharePoint 2013: Avoid default results in search result and content search web part with search box

August 9, 2013 10 comments

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.

Search_Box_1

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.

Search_Box_2

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.

Search_Box_3

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.

Search_Box_4

Search_Box_5

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.

Advertisements