Limiting results and paging
DSE Search integrates native driver paging with Apache Solr cursor-based paging
dse.yaml
The location of the dse.yaml file depends on the type of installation:
Package installations |
/etc/dse/dse.yaml |
Tarball installations |
installation_location/resources/dse/conf/dse.yaml |
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.
Note: 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 the driver documentation.
Using pagination (cursors) with CQL Solr queries
In dse.yaml, the cql_solr_query_paging option specifies when
to use pagination (also called cursors):
- 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 todriver
. - 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"}';
Note: 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.
It is not mandatory to use a sort clause. However, if a sort clause is not provided, sorting is undefined.
Examples
The word Journal is contained in ~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"}';
Note: If
cqlsh PAGING is enabled.