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.
When using CQL Solr queries with pagination enabled, you 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 Result paging with Cassandra drivers. |
Using pagination (cursors) with CQL Solr queries
In dse.yaml
, the cql_solr_query_paging
option specifies when to use pagination (also called cursors).
Default to the driver’s pagination settings for CQL Solr queries
When a driver connects to the database and executes a CQL SELECT statement using a search index (solr_query
option), you can specify to use the driver pagination settings by default by changing the cql_solr_query_paging
to driver
.
Persistently enable pagination in CQL Solr queries
To enable pagination persistently with CQL Solr queries, set cql_solr_query_paging: on
in dse.yaml and restart the node.
To dynamically enable pagination when cql_solr_query_paging: off
in dse.yaml
, use the "paging":"driver"
parameter:
select id from wiki.solr where solr_query='{"q":"*", "sort":"id asc", "paging":"driver"}';
It is not mandatory to use a sort clause. However, if a sort clause is not provided, sorting is undefined.
SearchAnalytics nodes use driver pagination settings
SearchAnalytics
nodes always use driver paging settings.
For more information, see DSE Analytics and Search integration.
Solr query paging examples
For these examples, assume you have a table where the word Journal
is contained in approximately 159 entries in the body or title.
-
Use
count
to determine how many rows match:SELECT count(*) FROM wiki.solr WHERE solr_query = 'Journal';
Count returns only a single row. It is not effected by the 10 row limit.
count ------- 159 (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:
id ---------- 23759487 23732986 23759527 23759551 23759455 23760810 23731949 23760697 23760871 23738270 (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"}';
If cqlsh
PAGING
is enabled, query results print in 100-line chunks followed by themore
prompt. Press Space to move to the next chunk. If you setPAGING OFF
, the entire set of results prints at once.