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, wildcard
Instance Attribute Details
#boost ⇒ Float
817
818
819
|
# File 'lib/couchbase/search_options.rb', line 817
def boost
@boost
end
|
#operator ⇒ nil, ...
820
821
822
|
# File 'lib/couchbase/search_options.rb', line 820
def operator
@operator
end
|
Instance Method Details
#must(*queries) ⇒ Object
[View source]
838
839
840
841
|
# File 'lib/couchbase/search_options.rb', line 838
def must(*queries)
@must.and_also(*queries)
self
end
|
#must_not(*queries) ⇒ Object
[View source]
844
845
846
847
|
# File 'lib/couchbase/search_options.rb', line 844
def must_not(*queries)
@must_not.or_else(*queries)
self
end
|
#should(*queries) ⇒ Object
[View source]
850
851
852
853
|
# File 'lib/couchbase/search_options.rb', line 850
def should(*queries)
@should.or_else(*queries)
self
end
|
#should_min(min) ⇒ Object
[View source]
832
833
834
835
|
# File 'lib/couchbase/search_options.rb', line 832
def should_min(min)
@should.min = min
self
end
|
#to_json(*args) ⇒ String
[View source]
856
857
858
859
860
861
862
863
864
865
866
867
868
|
# File 'lib/couchbase/search_options.rb', line 856
def to_json(*args)
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 unless @must.empty?
data["must_not"] = @must_not unless @must_not.empty?
data["should"] = @should unless @should.empty?
data["boost"] = boost if boost
data["operator"] = operator.to_s if operator
data.to_json(*args)
end
|