algolia / vue-instantsearch

👀 Algolia components for building search UIs with Vue.js
https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/vue
MIT License
853 stars 157 forks source link

How to prevent InstantSearch from loading the initial hits before query? #1164

Closed tom43983 closed 1 year ago

tom43983 commented 1 year ago

Hello, I am using InstantSearch for Vue. Everything works great, but the component loads all indexed documents on page load. In some indexes I have thousands of documents and I would like to prevent IS to load them all on the frontend on initial page load. So only loading the hits when a user actually enters a query. Is this possible in a simple way?

Haroenv commented 1 year ago

InstantSearch doesn't load all hits, but only the first page, so there's not thousands of items loaded, but the hitsPerPage (default 20). If you want to hide the hits on empty query you can follow this guide: https://www.algolia.com/doc/guides/building-search-ui/going-further/conditional-display/vue/#handling-empty-queries