Module: Cassandra::Protocol

Defined in:
lib/right_support/db/cassandra_model.rb

Instance Method Summary collapse

Instance Method Details

#_get_indexed_slices(column_family, index_clause, columns, count, start, finish, reversed, consistency) ⇒ Object

Monkey patch _get_indexed_slices so that it accepts list of columns when doing indexed slice, otherwise not able to get specific columns using secondary index lookup



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/right_support/db/cassandra_model.rb', line 31

def _get_indexed_slices(column_family, index_clause, columns, count, start, finish, reversed, consistency)
  column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family)
  if columns
    predicate = CassandraThrift::SlicePredicate.new(:column_names => [columns].flatten)
  else
    predicate = CassandraThrift::SlicePredicate.new(:slice_range =>
                                                      CassandraThrift::SliceRange.new(
                                                        :reversed => reversed,
                                                        :count    => count,
                                                        :start    => start,
                                                        :finish   => finish))
  end
  client.get_indexed_slices(column_parent, index_clause, predicate, consistency)
end