PHP-CASSANDRA-LUCENE Paging with sorting

I am tring to fetch sorted records with paging in cassandra which is using lucene indexes for searching and sorting

Note : There are total 26 rows in user table

Case 1 : Sorting in ascending order with paging

cqlsh > paging 10;
cqlsh > SELECT user_id FROM user WHERE category_id = ‘e4da3b7f-bbce-2345-d777-2b0674a318d5’ AND expr(user_index, ‘{filter:[{type:”match”, field:”is_primary”, value:true}], sort:[{field: “user_id”,reverse:false}]}’);

This will give all 26 rows in ascending order of user_id first 10 rows,second 10 rows then last 6 rows that is fine but issue in case 2

Case 2 : Sorting in descending order with paging

cqlsh > paging 10;
cqlsh > SELECT user_id FROM user WHERE category_id = ‘e4da3b7f-bbce-2345-d777-2b0674a318d5’ AND expr(user_index, ‘{filter:[{type:”match”, field:”is_primary”, value:true}], sort:[{field: “mac_address”,reverse:true}]}’);

This will give only 19 rows in descending order of user_id first 10 rows,then 9 rows same of first page

Is this indicate that cassandra paging and lucene sorting can’t use together ? if yes then any alternative to use sorting on lucen indexes with cassandra paging ? While answering please consider timeline based sorting and paging can’t apply here because i have to consider too many coloumns while sorting.

Thanks


Source: stackoverflow-php