我正在使用 Astyanax 客户端从 Cassandra 列族中读取数据。我的要求是通过 astyanax 查询列族的二级索引列。我能够从 astyanax 网站上找到一些示例,以使用索引列上的表达式从 Cassandra 读取数据。我使用示例编写了自己的代码:
OperationResult<Rows<String, String>> result = null;
IndexQuery<String, String> query = keyspace.prepareQuery("ColumnFamilyName").searchWithIndex().setRowLimit(100).autoPaginateRows(true).addExpression().whereColumn("ColumnNameWhichHasSecondaryIndex").equals().value("value");
result = query.execute();
for(Row<String, String> row : result.getResult()) {
...
}
这是我在运行此代码时面临的问题,它只返回 100 行,而列族有几千行满足查询条件。
我无法找到正确的 API/模式来解决我的问题。有人可以指导我解决这个问题吗?
Astanax 版本:1.56.24 Apache Cassandra 版本:1.1.8 Jdk 版本:1.7 平台:Rhel 5.4 32bit