【发布时间】:2017-07-09 13:30:01
【问题描述】:
我正在尝试在使用 lucene 索引进行搜索和排序的 cassandra 中通过分页获取已排序的记录
注意:用户表共有 26 行
案例1:分页升序排序
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}]}');
这将使所有 26 行按 user_id 的升序排列,前 10 行,后 10 行,然后是最后 6 行,这很好,但在第 2 种情况下会出现问题
案例2:分页降序排序
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:true}]}');
这将只给出 19 行,按 user_id 前 10 行的降序排列,然后是第一页的 9 行
这是否表明cassandra分页和lucene排序不能一起使用?如果是,那么任何替代方法可以使用 cassandra 分页对 lucen 索引进行排序?回答时请考虑基于时间轴的排序和分页不能在这里应用,因为我在排序时必须考虑太多的列。
【问题讨论】:
标签: php cassandra lucene cassandra-lucene-index bigdata