Hide search box when there are no results

When minimumResultsForSearch is positive, search box is displayed when there are no results.
Replace Pull Request #2821.
Resolves issue #508.