Class: Daedal::Queries::BoolQuery
- Defined in:
- lib/daedal/queries/bool_query.rb
Instance Method Summary collapse
- #add_must_not_query(q) ⇒ Object
- #add_must_query(q) ⇒ Object
- #add_should_query(q) ⇒ Object
- #to_hash ⇒ Object
- #verify_query(q) ⇒ Object
Methods inherited from BaseQuery
Instance Method Details
#add_must_not_query(q) ⇒ Object
34 35 36 37 |
# File 'lib/daedal/queries/bool_query.rb', line 34 def add_must_not_query(q) verify_query(q) must_not << q end |
#add_must_query(q) ⇒ Object
29 30 31 32 |
# File 'lib/daedal/queries/bool_query.rb', line 29 def add_must_query(q) verify_query(q) must << q end |
#add_should_query(q) ⇒ Object
24 25 26 27 |
# File 'lib/daedal/queries/bool_query.rb', line 24 def add_should_query(q) verify_query(q) should << q end |
#to_hash ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/daedal/queries/bool_query.rb', line 39 def to_hash result = {bool: {should: should.map {|q| q.to_hash}, must: must.map {|q| q.to_hash}, must_not: must_not.map {|q| q.to_hash}}} = {minimum_should_match: minimum_should_match, boost: boost} result[:bool].merge!(.select { |k,v| !v.nil? }) result end |