Class: ActiveKit::Search::Searcher

Inherits:
Bedrock::Bedrocker show all
Defined in:
lib/active_kit/search/searcher.rb

Instance Method Summary collapse

Methods inherited from Bedrock::Bedrocker

#create_describer, #for, #get_describer_names, #initialize, #run_describer_method

Constructor Details

This class inherits a constructor from ActiveKit::Bedrock::Bedrocker

Instance Method Details

#create_attribute(name, options) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/active_kit/search/searcher.rb', line 4

def create_attribute(name, options)
  describer_names = super

  depends_on = options.delete(:depends_on) || {}
  describer_names.each do |describer_name|
    set_callbacks(describer_name, depends_on)
    self.for(describer_name).add_attribute(name: name, options: options.deep_dup)
  end
end

#describer_method(describer, params) ⇒ Object



14
15
16
17
# File 'lib/active_kit/search/searcher.rb', line 14

def describer_method(describer, params)
  params[:page] = 1 if params.key?(:page) && params[:page].blank?
  self.for(describer.name).fetch(term: params.delete(:term), **params).records
end