Class: Couchbase::Cluster::SearchQuery::BooleanQuery
Overview
The boolean query is a useful combination of conjunction and disjunction queries.
Instance Attribute Summary collapse
Instance Method Summary
collapse
boolean_field, booleans, conjuncts, date_range, disjuncts, doc_id, geo_bounding_box, geo_distance, geo_polygon, match, match_all, match_none, match_phrase, numeric_range, phrase, prefix, query_string, regexp, term, term_range, #to_json, wildcard
Instance Attribute Details
#boost ⇒ Float
767
768
769
|
# File 'lib/couchbase/search_options.rb', line 767
def boost
@boost
end
|
Instance Method Details
#must(*queries) ⇒ Object
[View source]
785
786
787
788
|
# File 'lib/couchbase/search_options.rb', line 785
def must(*queries)
@must.and_also(*queries)
self
end
|
#must_not(*queries) ⇒ Object
[View source]
791
792
793
794
|
# File 'lib/couchbase/search_options.rb', line 791
def must_not(*queries)
@must_not.or_else(*queries)
self
end
|
#should(*queries) ⇒ Object
[View source]
797
798
799
800
|
# File 'lib/couchbase/search_options.rb', line 797
def should(*queries)
@should.or_else(*queries)
self
end
|
#should_min(min) ⇒ Object
[View source]
779
780
781
782
|
# File 'lib/couchbase/search_options.rb', line 779
def should_min(min)
@should.min = min
self
end
|
#to_h ⇒ Hash<Symbol, #to_json>
[View source]
803
804
805
806
807
808
809
810
811
812
813
814
|
# File 'lib/couchbase/search_options.rb', line 803
def to_h
if @must.empty? && @must_not.empty? && @should.empty?
raise ArgumentError, "BooleanQuery must have at least one non-empty sub-query"
end
data = {}
data[:must] = @must.to_h unless @must.empty?
data[:must_not] = @must_not.to_h unless @must_not.empty?
data[:should] = @should.to_h unless @should.empty?
data[:boost] = boost if boost
data
end
|