Example usage for org.apache.cassandra.db ReadCommand clusteringIndexFilter

List of usage examples for org.apache.cassandra.db ReadCommand clusteringIndexFilter

Introduction

In this page you can find the example usage for org.apache.cassandra.db ReadCommand clusteringIndexFilter.

Prototype

public abstract ClusteringIndexFilter clusteringIndexFilter(DecoratedKey key);

Source Link

Document

The clustering index filter this command to use for the provided key.

Usage

From source file:com.stratio.cassandra.lucene.IndexService.java

License:Apache License

/**
 * Returns the key range query represented by the specified {@link ReadCommand}.
 *
 * @param command the read command//from   ww w  . jav  a2 s .  co m
 * @return the key range query
 */
private Optional<Query> query(ReadCommand command) {
    if (command instanceof SinglePartitionReadCommand) {
        DecoratedKey key = ((SinglePartitionReadCommand) command).partitionKey();
        ClusteringIndexFilter clusteringFilter = command.clusteringIndexFilter(key);
        return Optional.of(query(key, clusteringFilter));
    } else if (command instanceof PartitionRangeReadCommand) {
        DataRange dataRange = ((PartitionRangeReadCommand) command).dataRange();
        return query(dataRange);
    } else {
        throw new IndexException("Unsupported read command %s", command.getClass());
    }
}