Limiting results and paging

DSE Search integrates native driver paging with Apache Solr™ cursor-based paging. Pagination, also called cursors, supports using a cursor to scan results. Solr pagination restrictions apply.

Using paging with CQL SELECT

A CQL SELECT run by DSE Search query uses deep paging when:

Required One of these applies

Driver is using paging

No LIMIT is provided.

Driver is using paging

The number of rows to return is greater than the driver’s page size.

Deep paging is not used if a LIMIT is provided, and the LIMIT is less than the driver’s fetch size.

Using paging with CQL Solr queries (solr_query)

When using CQL Solr queries with pagination enabled, your queries might experience a performance slowdown because Solr is not able to use its query result cache when pagination is configured. If you do not want to paginate through large result sets, disable pagination when running CQL Solr queries. See the driver documentation.

In dse.yaml, the cql_solr_query_paging option specifies when to use pagination:

SELECT id FROM wiki.solr
WHERE solr_query= '{"q":"*", "sort":"id asc", "paging":"driver"}' ;

SearchAnalytics nodes always use driver paging settings. See DSE Analytics and Search integration.

See the documentation for the CQL shell PAGING command and the driver.

If cqlsh PAGING is enabled, query results display in 100-line chunks followed by the more prompt. Press the space bar to move to the next chunk. When disabled with PAGING OFF, the entire results are displayed.

It is not mandatory to use a sort clause. However, if a sort clause is not provided, sorting is undefined.

Example of CQL SELECT query

SELECT * FROM wiki.solr WHERE id LIKE 'Journal%';

Examples of CQL Solr queries (solr_query)

The word Journal is contained in ~159 entries in the body or title. Use count to determine the number of rows that match:

SELECT count(*) FROM wiki.solr WHERE solr_query = 'Journal';

Count returns only a single row; it is not affected by the 10 row limit.


(1 rows)

Run the same query without count (and cql_solr_query_paging: off):

SELECT id FROM wiki.solr WHERE solr_query = 'Journal';

Only 10 rows are returned.


(10 rows)

To return all matching IDs, override the cql_solr_query_paging setting:

SELECT id FROM wiki.solr
WHERE solr_query='{"q":"Journal", "paging":"driver"}';

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000,