本文整理汇总了Java中me.prettyprint.cassandra.model.IndexedSlicesQuery.execute方法的典型用法代码示例。如果您正苦于以下问题:Java IndexedSlicesQuery.execute方法的具体用法?Java IndexedSlicesQuery.execute怎么用?Java IndexedSlicesQuery.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类me.prettyprint.cassandra.model.IndexedSlicesQuery
的用法示例。
在下文中一共展示了IndexedSlicesQuery.execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readAllColumnsBySecondaryIndex
import me.prettyprint.cassandra.model.IndexedSlicesQuery; //导入方法依赖的package包/类
@Override
public CassandraResultSet readAllColumnsBySecondaryIndex(Map<String, String> parameters, int limit) {
//TODO: Replace with {@link RangeSlicesQuery}
IndexedSlicesQuery<String, String, String> indexedSlicesQuery = HFactory.createIndexedSlicesQuery(keysp,
StringSerializer.get(), StringSerializer.get(), StringSerializer.get());
for (Map.Entry<String, String> entry : parameters.entrySet()) {
indexedSlicesQuery.addEqualsExpression(entry.getKey(), entry.getValue());
}
indexedSlicesQuery.setRange("", "", false, limit);
indexedSlicesQuery.setColumnFamily(this.columnFamily);
QueryResult<OrderedRows<String, String, String>> result = indexedSlicesQuery.execute();
return new HectorRowSliceResultSet(result);
}
示例2: testIndexedSlices
import me.prettyprint.cassandra.model.IndexedSlicesQuery; //导入方法依赖的package包/类
private void testIndexedSlices() {
Mutator<String> mutator = HFactory.createMutator(keyspace, stringSerializer);
for (int i = 0; i < 24; i++) {
mutator.addInsertion("fake_key_" + i, COLUMN_FAMILY_INDEXED_1,
HFactory.createStringColumn("fake_column_0", "fake_value_0_" + i))
.addInsertion("fake_key_" + i, COLUMN_FAMILY_INDEXED_1,
HFactory.createStringColumn("column_test_1", "column_test_1_value" + i))
.addInsertion("fake_key_" + i, COLUMN_FAMILY_INDEXED_1,
HFactory.createStringColumn("fake_column_1", "fake_value_1_" + i))
.addInsertion("fake_key_" + i, COLUMN_FAMILY_INDEXED_1,
HFactory.createStringColumn("fake_column_2", "fake_value_2_" + i))
.addInsertion(
"fake_key_" + i,
COLUMN_FAMILY_INDEXED_1,
HFactory.createColumn("birthdate", new Long(1974 + (i % 2)), stringSerializer,
LongSerializer.get()))
.addInsertion(
"fake_key_" + i,
COLUMN_FAMILY_INDEXED_1,
HFactory.createColumn("birthmonth", new Long(i % 12), stringSerializer,
LongSerializer.get()));
}
mutator.execute();
IndexedSlicesQuery<String, String, Long> indexedSlicesQuery = HFactory.createIndexedSlicesQuery(keyspace,
stringSerializer, stringSerializer, LongSerializer.get());
indexedSlicesQuery.setColumnFamily(COLUMN_FAMILY_INDEXED_1);
indexedSlicesQuery.addEqualsExpression("birthdate", 1975L);
indexedSlicesQuery.addGtExpression("birthmonth", 6L);
indexedSlicesQuery.addLtExpression("birthmonth", 8L);
indexedSlicesQuery.setColumnNames("birthdate", "birthmonth");
indexedSlicesQuery.setStartKey("");
QueryResult<OrderedRows<String, String, Long>> result = indexedSlicesQuery.execute();
System.out.println("The results should only have 4 entries: " + result.get().getCount());
}