Page results on initial load - Algolia Instantsearch

I am using Algolia InstantSearch with vanilla JS for a few projects. A common request is that we change the results on load. So for example, choosing the search results that appear when you first visit the search page.

We are using Drupal on the backend (just for reference).

I was just wondering if anybody had any ideas on how to implement that and what Algolia’s best practice would be?

Hi there,

It seems to me that you can query your Algolia index with the empty query “” in order to avoid having an empty search page when you first visit it.

Please let me know if I haven’t understood your question well.

Best,
Benjamin

Hi Benjamin,

Thanks for your message.

I think I understand what you mean. Then would I query my own database for results if the query is NULL? So inside my searchFunction when initiating my index?

Would that be the Algolia best practice?

Thanks,
Peter