module Elastics::Result::Search

Public Class Methods

extended(result) click to toggle source

extend the hits results on extended

# File lib/elastics/result/search.rb, line 11
def self.extended(result)
  result['hits']['hits'].each { |h| h.extend(Document) }
  result['hits']['hits'].extend Struct::Paginable
  result['hits']['hits'].setup(result['hits']['total'], result.variables)
end
should_extend?(result) click to toggle source

extend if result comes from a search url

# File lib/elastics/result/search.rb, line 6
def self.should_extend?(result)
  result.response.url =~ /\b_m?search\b/ && result['hits']
end

Public Instance Methods

aggregations() click to toggle source
# File lib/elastics/result/search.rb, line 22
def aggregations
  self['aggregations']
end
collection() click to toggle source
# File lib/elastics/result/search.rb, line 17
def collection
  self['hits']['hits']
end
Also aliased as: documents
documents()
Alias for: collection