Class: Daedal::Queries::MultiMatchQuery
- Defined in:
- lib/daedal/queries/multi_match_query.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ MultiMatchQuery
constructor
A new instance of MultiMatchQuery.
- #to_hash ⇒ Object
Methods inherited from BaseQuery
Constructor Details
#initialize(options = {}) ⇒ MultiMatchQuery
Returns a new instance of MultiMatchQuery.
25 26 27 28 29 30 31 |
# File 'lib/daedal/queries/multi_match_query.rb', line 25 def initialize(={}) super if fields.empty? raise "Must give at least one field to match on" end end |
Instance Method Details
#to_hash ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/daedal/queries/multi_match_query.rb', line 33 def to_hash result = {multi_match: {query: query, fields: fields}} = {minimum_should_match: minimum_should_match, cutoff_frequency: cutoff_frequency, type: type, analyzer: analyzer, boost: boost, fuzziness: fuzziness, operator: operator} result[:multi_match].merge!(.select { |k,v| !v.nil? }) result end |