instantsearch: setIndex should not set page to 0 (and any other method)

I understand why it was there in the first place (the setPage(0)) but it the snippet bellow will not load page 2. And I think it is not what we want.

helper.setCurrentPage(2);
helper.setIndex(indexName);
helper.search()

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Comments: 27 (23 by maintainers)

Commits related to this issue

Most upvoted comments

+1. I spent hours figuring out what was happening. I based my searchFunction on what is provided by https://www.algolia.com/doc/api-reference/widgets/instantsearch/js/#widget-param-searchfunction But even though the comments state // we re-apply the previous page, it’s so counter-intuitive and hard to understand!

  1. It appears like the button (view more, page 2) does not work.
  2. You need to disable caching to see actual (redundants) requests issued and see page=0
  3. You need to understand why page isn’t incremented (and find this ticket or read X times the above link)

Some clearer warning must be set somewhere about this setPage() usage within searchFunction.

Hello, I have an issue, probably linked to this one.

This workflow call right my page :

  • helper.clearRefinements
  • helper.setQueryParameter
  • helper.addFacetRefinement
  • helper.addDisjunctiveFacetRefinement
  • helper.on('result', function(){})
  • helper.setCurrentPage
  • helper.search

But in this order, it’s not working :

  • helper.setCurrentPage
  • helper.clearRefinements
  • helper.setQueryParameter
  • helper.addFacetRefinement
  • helper.addDisjunctiveFacetRefinement
  • helper.on('result', function(){})
  • helper.search

Maybe it’s important to document somewhere when we should call setCurrentPage ?

Have a nice day, Gaël