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:"https://sharepoint.contoso.com/Documents/*"
to this:
\\{searchboxquery?} path:"https://sharepoint.contoso.com/Documents/*"
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:
<style>
#NoResult{
display: none;
visibility: hidden;
}
</style>
Now, I only get results when something is entered into the search box, and no error message if there are no results.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.