Class: Riak::IndexCollection
- Defined in:
- lib/riak/index_collection.rb
Overview
IndexCollection provides extra tools for managing index matches returned by a Secondary Index query. In Riak 1.4, these queries can be paginaged, and match keys up with the index values they matched against.
Instance Attribute Summary collapse
-
#continuation ⇒ String
paginated query.
-
#with_terms ⇒ Hash<Integer/String, String>
Integer, depending on whether the query was a binary or integer) to arrays of keys.
Class Method Summary collapse
Methods inherited from Array
#extract_options!, #to_param, #to_query
Instance Attribute Details
#continuation ⇒ String
paginated query.
10 11 12 |
# File 'lib/riak/index_collection.rb', line 10 def continuation @continuation end |
Class Method Details
.new_from_json(json) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/riak/index_collection.rb', line 17 def self.new_from_json(json) parsed = JSON.parse json fresh = nil if parsed['keys'] fresh = new parsed['keys'] elsif parsed['results'] fresh_terms = load_json_terms(parsed) fresh = new fresh_terms.values.flatten fresh.with_terms = fresh_terms else fresh = new [] end fresh.continuation = parsed['continuation'] fresh end |
.new_from_protobuf(message) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/riak/index_collection.rb', line 34 def self.new_from_protobuf() fresh = nil if .keys fresh = new .keys elsif .results fresh_terms = load_pb_terms() fresh = new fresh_terms.values.flatten fresh.with_terms = fresh_terms else fresh = new end fresh.continuation = .continuation fresh end |