Do not start with results in a SharePoint 2016 Search Webpart


I had a need to create a page with a search webpart on it, but I didn't want to show results as the default to begin with on the page. 

To accomplish this, in the search results query I changed this:

{searchboxquery} path:"*"

to this:

\\{searchboxquery?} path:"*" 

This makes it so that there are no default search results when the page is loaded, but it gives results when something is entered into the search box.

Taking it a step further, when the page is loaded, it gives an error that there are no search results. I wanted to remove that. So I did that by adding this CSS into a script editor webpart:



display: none;

visibility: hidden;



Now, I only get results when something is entered into the search box, and no error message if there are no results.


Share on Google Plus

About Tom DeMeulenaere

Highly accomplished information technology professional with extensive knowledge in System Center Configuration Manager, Windows Server, SharePoint, and Office 365.
    Blogger Comment


Post a Comment

Note: Only a member of this blog may post a comment.