Module: Intel::Track

Included in:
Searchkick::Search
Defined in:
lib/intel/track.rb

Instance Method Summary collapse

Instance Method Details

#search_with_track(term, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/intel/track.rb', line 4

def search_with_track(term, options = {})
  results = search_without_track(term, options)

  if options[:track]
    attributes = options[:track] == true ? {} : options[:track]
    Intel::Search.create({searchable_type: self.name, query: term, results_count: results.total_count}.merge(attributes))
  end

  results
end