class Daedal::Queries::MultiMatchQuery
Public Class Methods
new(options={})
click to toggle source
Fields cannot be an empty array… should eventually refactor this kind of thing out of initialize
Calls superclass method
# File lib/daedal/queries/multi_match_query.rb, line 24 def initialize(options={}) super options if fields.empty? raise "Must give at least one field to match on" end end
Public Instance Methods
to_hash()
click to toggle source
# File lib/daedal/queries/multi_match_query.rb, line 32 def to_hash result = {multi_match: {query: query, fields: fields}} options = {minimum_should_match: minimum_should_match, cutoff_frequency: cutoff_frequency, type: type, analyzer: analyzer, boost: boost, fuzziness: fuzziness, operator: operator, prefix_length: prefix_length, max_expansions: max_expansions} result[:multi_match].merge!(options.select { |k,v| !v.nil? }) result end