Class: RiakRecord::Finder::ErlangEnhanced

Inherits:
Basic
  • Object
show all
Defined in:
lib/riak_record/finder/erlang_enhanced.rb

Instance Method Summary collapse

Methods inherited from Basic

#all, #any?, #count, #count_by, #each, #empty?, #find, #first, #initialize, #page, #to_a

Constructor Details

This class inherits a constructor from RiakRecord::Finder::Basic

Instance Method Details

#pluck_by_map_reduce(attribute, timeout = nil) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/riak_record/finder/erlang_enhanced.rb', line 4

def pluck_by_map_reduce(attribute, timeout = nil)
  map_method, map_arg = map_method_for_attribute(attribute, "map_pluck_index", "map_pluck_value")
  mr = Riak::MapReduce.new(@finder_class.client).
    index(@bucket, @index, @value).
    map(['riak_record_kv_mapreduce', map_method], :keep => true, :arg => [map_arg])
  mr.timeout = timeout if timeout.present?
  mr.run
end