class Stretcher::SearchResults

Conveniently represents elastic search results in a more compact fashion

Available properties:

Public Instance Methods

docs()
Alias for: documents
documents() click to toggle source

Returns a 'prettier' version of elasticsearch results Also aliased as docs This will:

  1. Return either '_source' or 'fields' as the base of the result

  2. Merge any keys beginning with a '_' into it as well (such as '_score')

  3. Copy the 'highlight' field into '_highlight'

# File lib/em/stretcher/search_results.rb, line 20
def documents
  raw_plain.bind! do |result|
    result.hits.hits.map do |hit|
      doc = extract_source(hit)
      copy_underscores(hit, doc)
      copy_highlight(hit, doc)
      doc
    end
  end
end
Also aliased as: docs