I am using algolia javascript api for retrieving all records in my index using browse function, but still it is returning 1000 records. Here is my code:
function load_location_list(){
var client = algoliasearch('ID', 'KEY');
var index_name = "locations_new";
var attribute_list = "*";
var index = client.initIndex(index_name);
index.browse({
"attributesToRetrieve": attribute_list,
}).then(function search_Success(response) {
console.log(response);
});
}
If you send a request for a page that doesn’t exist, or is out-of-range, that is, when page >= nbPages, Algolia doesn’t return an error. Instead, it returns 0 results. Leveraging page and hitsPerPage is best practice for adding pagination functionality.
Pagination Limitations 1000 hit limit By default, Algolia limits the maximum number of hits that can be retrieved via a query to 1000. This restriction is in place to not only guarantee optimal performance, but also to ensure your data cannot be easily extracted.
The search query only allows for the retrieval of up to 1000 hits . If you need to retrieve more than 1000 hits (e.g. for SEO), you can either leverage the Browse index method or increase the paginationLimitedTo parameter. # Found an issue?
However, Algolia does enrich them with a few additional fields, such as _highlightResult, _snippetResult, _rankingInfo, and _distinctSeqID. hits: [ { field1 : "", field2 : "", [...], _highlightResult: { [...] }, _snippetResult: { [...] }, _rankingInfo: { [...] }, _distinctSeqID : }, [...] ] The number of hits matched by the query.
Actually, browse
doesn't return more than 1000 elements at the first call. However, the response contains a cursor
that you can use to access the next elements with the browseFrom
function.
However, the previous method is kind of manual. You probably want to use the browseAll
function instead which lets you access all the elements sequentially.
You can find more informations about all the browse*
functions in the README of the JS client (also available in the Algolia documentation).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With