Class: Searchkick::Results

Inherits:
Tire::Results::Collection
  • Object
show all
Defined in:
lib/searchkick/results.rb

Instance Method Summary collapse

Instance Method Details

#__find_records_by_ids(klass, ids) ⇒ Object

fixes deprecation warning



13
14
15
# File 'lib/searchkick/results.rb', line 13

def __find_records_by_ids(klass, ids)
  @options[:load] === true ? klass.find(ids) : klass.includes(@options[:load][:include]).find(ids)
end

#suggestionsObject



4
5
6
7
8
9
10
# File 'lib/searchkick/results.rb', line 4

def suggestions
  if @response["suggest"]
    @response["suggest"].values.flat_map{|v| v.first["options"] }.sort_by{|o| -o["score"] }.map{|o| o["text"] }.uniq
  else
    raise "Pass `suggest: true` to the search method for suggestions"
  end
end