Class: Couchbase::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
827
828
829
|
# File 'lib/couchbase/search_options.rb', line 827
def boost
@boost
end
|
Instance Method Details
#must(*queries) ⇒ Object
[View source]
845
846
847
848
|
# File 'lib/couchbase/search_options.rb', line 845
def must(*queries)
@must.and_also(*queries)
self
end
|
#must_not(*queries) ⇒ Object
[View source]
851
852
853
854
|
# File 'lib/couchbase/search_options.rb', line 851
def must_not(*queries)
@must_not.or_else(*queries)
self
end
|
#should(*queries) ⇒ Object
[View source]
857
858
859
860
|
# File 'lib/couchbase/search_options.rb', line 857
def should(*queries)
@should.or_else(*queries)
self
end
|
#should_min(min) ⇒ Object
[View source]
839
840
841
842
|
# File 'lib/couchbase/search_options.rb', line 839
def should_min(min)
@should.min = min
self
end
|
#to_h ⇒ Hash<Symbol, #to_json>
[View source]
863
864
865
866
867
868
869
870
871
872
|
# File 'lib/couchbase/search_options.rb', line 863
def to_h
raise ArgumentError, "BooleanQuery must have at least one non-empty sub-query" if @must.empty? && @must_not.empty? && @should.empty?
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
|