Arda
Arda

Reputation: 6936

How to show more than 1000 records in Algolia instantsearch.js

I'm using Algolia along with instantsearch.js in a project to make searches and show categories and contents inside them (category page and search pages are powered by Algolia). We are using instantsearch.js v1 is from cdn.

Our main issue is that search doesn't provide more than 1000 records which we need.

As far as I understand correctly, browse() method provides more results, but it's not usable in instantsearch.js.

Also, after reading docs, I found out that there's a new option called paginationLimitedTo, which allows displaying more than 1000 records:

https://www.algolia.com/doc/rest-api/search/#paginationlimitedto

So, setting this would allow displaying more than 1000 records.

Can you help me here, how should I achieve getting more than 1000 records, or if it'd achieve our goal, how do we set this paginationLimitedTo attribute in instantsearch.js ? I'm okay if I need to build or edit instantsearch.js for the time being.

Thanks in advance,

Upvotes: 1

Views: 3212

Answers (1)

Guy Daher
Guy Daher

Reputation: 5601

In order to change the value for paginationLimitedTo, you will need to create a custom client object, then get your index by doing calling client.initIndex(indexName), and then change the setting by calling

index.setSettings({
  paginationLimitedTo: 1000
});

You can check the guide for that in the docs here.

Also, please remember the following:

We recommend keeping the default value to guarantee excellent performance. Increasing the pagination limit will have a direct impact on the performance of search queries. A too high value will also make it very easy for anyone to retrieve (“scrape”) your entire dataset.

Upvotes: 2

Related Questions