Class: Elasticated::IndexSelector

Inherits:
Object
  • Object
show all
Includes:
Mixins::BlockEvaluation
Defined in:
lib/elasticated/index_selector.rb

Instance Method Summary collapse

Methods included from Mixins::BlockEvaluation

#evaluate

Instance Method Details

#index_for_document(document) ⇒ Object



28
29
30
31
# File 'lib/elasticated/index_selector.rb', line 28

def index_for_document(document)
  params = strategy_params_for_document document
  index_for_params params
end

#index_for_params(params) ⇒ Object



11
12
13
14
15
# File 'lib/elasticated/index_selector.rb', line 11

def index_for_params(params)
  indices = indices_for_params params
  raise "Only one index can be affected" if indices.count > 1
  indices.first
end

#index_for_percolatorObject



33
34
35
36
# File 'lib/elasticated/index_selector.rb', line 33

def index_for_percolator
  params = strategy_params_for_percolator
  index_for_params params
end

#indices_for_params(params) ⇒ Object



17
18
19
20
21
# File 'lib/elasticated/index_selector.rb', line 17

def indices_for_params(params)
  indices = strategy.call params
  raise "At least one index should be affected" if indices.count < 1
  indices
end

#indices_for_query(query) ⇒ Object



23
24
25
26
# File 'lib/elasticated/index_selector.rb', line 23

def indices_for_query(query)
  params = strategy_params_for_query query
  indices_for_params params
end