Overview
A common pattern when browsing results on mobile is having an infinite scroll, by loading results as the user scrolls through the list of results. With InstantSearch this is as easy as setting the attribute infiniteScroll
of a Hits
widget to true
.
Go further than 1000 hits
By default Algolia limit the number of hits you can retrieve for a query to
1000
; when doing an infinite scroll, you usually want to go over this limit.
1
2
3
| $index->setSettings([
'paginationLimitedTo' => 1000
]);
|
1
2
3
| index.set_settings({
paginationLimitedTo: 1000
})
|
1
2
3
| index.setSettings({
paginationLimitedTo: 1000
});
|
1
2
3
| index.set_settings({
'paginationLimitedTo': 1000
})
|
1
2
3
4
5
6
| let query = Query(query: "query")
query.paginationLimitedTo = 1000
index.search(query, completionHandler: { (res, error) in
print(res)
})
|
1
2
3
| index.setSettings(
new JSONObject().put("paginationLimitedTo", 1000)
);
|
1
2
3
4
| IndexSettings settings = new IndexSettings();
settings.PaginationLimitedTo = 1000;
index.SetSettings(settings);
|
1
2
3
| index.setSettings(
new IndexSettings().setPaginationLimitedTo(1000)
);
|
1
2
3
| res, err := index.SetSettings(search.Settings{
opt.PaginationLimitedTo(1000),
})
|
1
2
3
4
5
| client.execute {
changeSettings of "myIndex" `with` IndexSettings(
paginationLimitedTo = Some(1000)
)
}
|
1
2
3
4
5
| val settings = settings {
paginationLimitedTo = 1000
}
index.setSettings(settings)
|
Disabling the limit does not mean that we will be able to go until the end of the hits,
but just that Algolia will go as far as possible in the index to retrieve results in a reasonable time.
</section>