class Tire::Search::Highlight

www.elasticsearch.org/guide/reference/api/search/highlighting.html

Public Class Methods

new(*args) click to toggle source
# File lib/tire/search/highlight.rb, line 8
def initialize(*args)
  @options  = (args.last.is_a?(Hash) && args.last.delete(:options)) || {}
  extract_highlight_tags
  @fields   = args.inject({}) do |result, field|
    field.is_a?(Hash) ? result.update(field) : result[field.to_sym] = {}; result
  end
end

Public Instance Methods

to_hash() click to toggle source
# File lib/tire/search/highlight.rb, line 20
def to_hash
  { :fields => @fields }.update @options
end
to_json(options={}) click to toggle source
# File lib/tire/search/highlight.rb, line 16
def to_json(options={})
  to_hash.to_json
end