本文整理汇总了Java中me.prettyprint.cassandra.model.IndexedSlicesQuery类的典型用法代码示例。如果您正苦于以下问题:Java IndexedSlicesQuery类的具体用法?Java IndexedSlicesQuery怎么用?Java IndexedSlicesQuery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IndexedSlicesQuery类属于me.prettyprint.cassandra.model包,在下文中一共展示了IndexedSlicesQuery类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: POSSlicesQueryIterator
import me.prettyprint.cassandra.model.IndexedSlicesQuery; //导入依赖的package包/类
/**
* Builds a new iterator with the given data.
*
* @param dictionary the store dictionary.
* @param isq the indexed slice query.
* @param limit the result limit.
* @param cf the column family name.
* @param keyspace the keyspace.
*/
POSSlicesQueryIterator(
final ITopLevelDictionary dictionary,
final IndexedSlicesQuery<byte[], Composite, byte[]> isq,
final int limit,
final String cf,
final Keyspace keyspace) {
_dictionary = dictionary;
_limit = limit;
_cf = cf;
_keyspace = keyspace;
_rows = new IndexedSlicesIterator<byte[], Composite, byte[]>(isq, new byte[0]);
}
示例2: 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);
}
示例3: 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());
}