Using Solr pagination (cursors)

Search pagination, also called cursors, supports using a cursor to scan deep result sets. Solr pagination restrictions apply.

Search paginates in two ways:
  • The default pagination for search uses start and rows parameters in CQL search.
  • Appropriate only for paging through deep result sets, search pagination with cursors is the transparent use of Solr cursors through CQL native protocol.
Search pagination, also called cursors, supports using a cursor to scan results. DataStax Enterprise integrates native driver paging with Solr cursor-based paging for paging through deep result sets. Most workloads do not require this functionality. Solr pagination restrictions apply.
Note: When using CQL Solr queries with cursor pagination enabled, Solr is not able to use its query result cache (QueryResultCache). However, the best practice is not to use the QueryResultCache. Enable search pagination only if you require paging through large result sets.

You can use search pagination with CQL Solr queries and the Solr HTTP API.

Enabling cursors with CQL Solr queries 

Set the cql_solr_query_paging option in the dse.yaml file as appropriate for the workload. To turn pagination on: To turn pagination off for all CQL Solr queries:

See the driver documentation.

Constraints when using Solr pagination (cursors)

These constraints apply to using a cursorMark parameter in a Solr request:

  • CursorMark and start are mutually exclusive parameters.

    Specify requests with a value of 0 or do not include a start parameter.

  • Sort clauses are not mandatory, however if a sort clause is not provided, sorting is undefined.

    If you specify a sort clause, it must include a uniqueKey field, like asc or desc.

    For example, if id is the uniqueKey field, then sort parameters like id asc and name asc, id desc are valid, while name asc by itself is not valid.

Examples
SELECT * from ks.cf where solr_query='{"q":"*:*", "sort":"id asc, id2 asc"}' 
SELECT * from ks.cf where solr_query='{"q":"*:*"}' 

Using cursors with the HTTP API 

To use cursors with the Solr HTTP API, it is not mandatory to provide a sort clause. However, if a sort clause is not provided, sorting is undefined. Do not make assumptions on sorting. Follow the steps in Using CQL Solr queries.

The location of the dse.yaml file depends on the type of installation:
Installer-Services /etc/dse/dse.yaml
Package installations /etc/dse/dse.yaml
Installer-No Services install_location/resources/dse/conf/dse.yaml
Tarball installations install_location/resources/dse/conf/dse.yaml