Return default result set when no results are found

We would like to be able to return the results of an empty search when we get no hits from the user’s query. This would essentially work like removeWordsIfNoResults except that it would actually remove all words. Is there a feature like this? If not, what is the recommended way to simulate this with Angular InstantSearch?

@jgraf welcome back!

We have some great documentation here that talks about handling empty or insufficient results. I think this section about allOptional may be of the most interest. This won’t show an empty query but will remove words until something is returned, which will be theoretically more relevant.

I don’t believe we have an out-of-the-box way to show an empty query if no results are returned, however, you could handle this scenario in your application itself. If zero hits are returned you could then submit another query with an empty query. We don’t do this out of the box since we focus on relevant results.

One other thing you could consider is if you are using our Recommend models, you could show the trending facets or trending items if no results are found. We have some information here in our documentation.

Happy to help further, let us know! Thanks!

Thanks, Michael, for the detailed answer! I have already looked at the documentation about insufficient results, but that is not really the issue. We never want to see an empty “no results” page even for searches like “pftpftpftpft”. If we wanted to submit another query then is there a hook we would use to trigger that? I think we are using Angular InstantSearch widgets to render our page.

@jgraf a custom widget should be able to do what you need. We don’t have a pre-made example I could find around your exact use case, but we do have an example here doing a different connector and the documentation can be found here.

Instead of connectMenu, you’d want to use the connectSearchBox connector and trigger a refine event (which triggers the search functionality).

I would be interested to see if anyone else has an idea as well. Hope this helps though, thanks!