List of usage examples for org.apache.cassandra.db.filter ClusteringIndexSliceFilter requestedSlices
public Slices requestedSlices()
From source file:com.stratio.cassandra.lucene.key.KeyMapper.java
License:Apache License
/** * Returns the start {@link ClusteringPrefix} of the first partition of the specified {@link DataRange}. * * @param dataRange the data range//from www . ja v a2s .c om * @return the start clustering prefix of {@code dataRange}, or {@code null} if there is no such start */ public static Optional<ClusteringPrefix> startClusteringPrefix(DataRange dataRange) { PartitionPosition startPosition = dataRange.startKey(); if (startPosition instanceof DecoratedKey) { DecoratedKey startKey = (DecoratedKey) startPosition; ClusteringIndexFilter filter = dataRange.clusteringIndexFilter(startKey); if (filter instanceof ClusteringIndexSliceFilter) { ClusteringIndexSliceFilter sliceFilter = (ClusteringIndexSliceFilter) filter; Slices slices = sliceFilter.requestedSlices(); return Optional.of(slices.get(0).start()); } } return Optional.empty(); }
From source file:com.stratio.cassandra.lucene.key.KeyMapper.java
License:Apache License
/** * Returns the stop {@link ClusteringPrefix} of the last partition of the specified {@link DataRange}. * * @param dataRange the data range/*w w w. ja v a 2 s. c om*/ * @return the stop clustering prefix of {@code dataRange}, or {@code null} if there is no such start */ public static Optional<ClusteringPrefix> stopClusteringPrefix(DataRange dataRange) { PartitionPosition stopPosition = dataRange.stopKey(); if (stopPosition instanceof DecoratedKey) { DecoratedKey stopKey = (DecoratedKey) stopPosition; ClusteringIndexFilter filter = dataRange.clusteringIndexFilter(stopKey); if (filter instanceof ClusteringIndexSliceFilter) { ClusteringIndexSliceFilter sliceFilter = (ClusteringIndexSliceFilter) filter; Slices slices = sliceFilter.requestedSlices(); return Optional.of(slices.get(slices.size() - 1).end()); } } return Optional.empty(); }
From source file:com.stratio.cassandra.lucene.key.KeyMapper.java
License:Apache License
/** * Returns a Lucene {@link Query} to retrieve all the rows in the specified clustering slice filter. * * @param key the partition key//from w w w. ja v a 2s.c o m * @param sliceFilter the slice filter * @return the Lucene query */ public Query query(DecoratedKey key, ClusteringIndexSliceFilter sliceFilter) { Slices slices = sliceFilter.requestedSlices(); ClusteringPrefix startBound = slices.get(0).start(); ClusteringPrefix stopBound = slices.get(slices.size() - 1).end(); return query(key, startBound, stopBound, false, false); }