More in Learn

Pagination in Search Results

The Search API allows paginating the results of your search by passing the “first” and “after” input arguments in your search queries. In the results you can also request for the page information, to keep track of the page’s last item and if there is another available next page.

Example Pagination Query

Circle loading spinnerImage of a partial circle indicating &qoute;loading&qoute;.Fetching snippet...

Using Pagination

Bellow is an example of using the Search query’s “first” and “after” arguments to get the second page of the results.

The after argument is a cursor. In the case of the Crystallize search API this is basically a base64 encoded version of the offset. If you have a search result and want to jump in at a specific offset, say number 42 in the search result list, you can just add the base64 encoded version of 42. Which is “NDI=”. Like this:

query CatalogueSearch {
search(first: 1, after: "NDI=") {
pageInfo {
hasNextPage
endCursor
totalNodes
}
edges {
node {
name
}
}
}
}
People showing thumbs up

Need further help?

Join and ask our
slack community.

Join our slack community