Hi!
I’m using InstantSearch.js
and have implemented the infiniteHits
widget.
Three questions:
1.) I have Algolia implemented on a page with URL https://mysite.com/products/.
Initially, 10 results are shown. When the load more button is clicked, as expected, 10 more results are shown.
But, the page URL changes and becomes https://mysite.com/products/?page=2.
How can I prevent ?page= from being appended to the URL?
2.) I use the cache setting: sessionStorageCache
.
Is it possible to specify that the cache be cleared if the page they visit on my site is not related to search?
Example: if a user is on the page with search /products/ and navigates to /about/, and returns to /products/, cache should be cleared. But if they click on a product in search results /products/1/ and return, no cache is not cleared.
If so, can you please explain how and/or point me in the right direction.
3.) Do clicks on the load more button count towards the search operations/requests limit?
My infiniteHits code:
const search = instantsearch({
indexName: 'index',
searchClient: algoliasearch(
'1234',
'5678'
),
routing: {
stateMapping: instantsearch.stateMappings.singleIndex('index')
}
});
const sessionStorageCache =
instantsearch.createInfiniteHitsSessionStorageCache();
instantsearch.widgets.infiniteHits({
cache: sessionStorageCache,
container: '#infinite-hits',
templates: {
empty: `...`,
item: `...`
}
})
Thank you and happy holidays.