Class: Hyperion::Riak::OptimizedFilterOrder

Inherits:
Object
  • Object
show all
Defined in:
lib/hyperion/riak/optimized_filter_order.rb

Instance Method Summary collapse

Constructor Details

#initialize(filters, bucket_name) ⇒ OptimizedFilterOrder

Returns a new instance of OptimizedFilterOrder.



7
8
9
10
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 7

def initialize(filters, bucket_name)
  @bucket_name = bucket_name
  @filters = filters
end

Instance Method Details

#filtersObject



28
29
30
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 28

def filters
  optimal_strategy.filters
end

#optimal_index_fieldObject



20
21
22
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 20

def optimal_index_field
  optimal_strategy.optimal_index_field
end

#optimal_index_valueObject



24
25
26
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 24

def optimal_index_value
  optimal_strategy.optimal_index_value
end

#optimal_strategyObject



12
13
14
15
16
17
18
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 12

def optimal_strategy
  @optimal_strategy ||= OPTIMAL_ORDER.map do |strategy_klass|
    strategy_klass.new(@filters, @bucket_name)
  end.find do |strategy|
    strategy.can_optimize?
  end
end