Reputation: 11
I am using Astyanax client to read data from Cassandra column families. My requirement is to query on a secondary index column of a column family through astyanax. I was able to find a few examples from the astyanax website to read data from Cassandra using an expression on an index column. I used the examples to write my own code:
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()) {
...
}
This is the issue I am facing while running this code is it is only returning me 100 rows, while the column family has a few thousand rows that satisfy the query criteria.
I am not able to find the right API/pattern to address my issue. Could some one please guide me on this issue please?
Astanax Version: 1.56.24 Apache Cassandra Version: 1.1.8 Jdk Version: 1.7 Platform: Rhel 5.4 32bit
Upvotes: 0
Views: 641
Reputation: 21
setRowLimit(100) means every time you execute the query, it return at most 100 items. So if you have more than 100 items, you should execute query again and again to get all the result under the setting autoPaginateRows(true)
Upvotes: 2