HomeDev guideRecipesAPI ReferenceGraphQL
Dev guideUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Cursor

How to get large amounts of documents using batch retrieval. The backend system preserves the state of the result set.

  1. By default the cursor is not enabled. To enable it, select cursor to the GQL query to get the cursor in combination with a query in where using an empty string "" as value, such as cursor: "".
  2. The response has a cursor value, and then gets the next batches using that cursor value in the GQL query.
  3. The results for the first query is preserved in the current state (stateful), 10 minutes per request, and after that time, the cursor expires and is no longer valid.
  4. Continue until there are no more results. The number of results per batch depends on the number set by limit. For the first query with cursor enabled, the skip is ignored. You can implement this by ignoring the first batches of results.
  5. You should sort by DOC for fastest retrieval.
  6. At least 1 content item field must be projected or else you will get an error. Only total is not sufficient because it is not a field of an item in items.

Example request, where you get the batches per one document:

{
  StandardPage(
    cursor: "FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFnh3Qmszbmh0UkxPeWVGVHBLcUtQVWcAAAAAAAAATRZJVkJ4eFZBdVM5dTI4R1UzVUFSOEpn"
    limit: 1
    orderBy: {_ranking: DOC}
  ) {
    items {
      Name
      Url
      RouteSegment
      Changed
    }
    cursor
  }
}