Class: Hyperion::Riak::RangeStrategy
- Inherits:
-
Object
- Object
- Hyperion::Riak::RangeStrategy
- Defined in:
- lib/hyperion/riak/optimized_filter_order.rb
Instance Method Summary collapse
- #can_optimize? ⇒ Boolean
- #filters ⇒ Object
-
#initialize(filters, bucket_name) ⇒ RangeStrategy
constructor
A new instance of RangeStrategy.
- #optimal_index_field ⇒ Object
- #optimal_index_value ⇒ Object
Constructor Details
#initialize(filters, bucket_name) ⇒ RangeStrategy
Returns a new instance of RangeStrategy.
64 65 66 67 |
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 64 def initialize(filters, bucket_name) @filters = filters @optimizer = OptimizedRangeFilters.new(filters) end |
Instance Method Details
#can_optimize? ⇒ Boolean
69 70 71 |
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 69 def can_optimize? @optimizer.less_than_filter && @optimizer.greater_than_filter end |
#filters ⇒ Object
81 82 83 |
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 81 def filters @optimizer.remaining_filters end |
#optimal_index_field ⇒ Object
73 74 75 |
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 73 def optimal_index_field @optimizer.less_than_filter.field end |
#optimal_index_value ⇒ Object
77 78 79 |
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 77 def optimal_index_value @value ||= @optimizer.less_than_filter.value.to_s .. @optimizer.greater_than_filter.value.to_s end |