Class: Couchbase::SearchQuery::ConjunctionQuery
Overview
Result documents must satisfy all of the child 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
Constructor Details
#initialize(*queries) {|self| ... } ⇒ ConjunctionQuery
Returns a new instance of ConjunctionQuery.
742
743
744
745
746
|
# File 'lib/couchbase/search_options.rb', line 742
def initialize(*queries)
super()
@queries = queries.flatten
yield self if block_given?
end
|
Instance Attribute Details
#boost ⇒ Float
737
738
739
|
# File 'lib/couchbase/search_options.rb', line 737
def boost
@boost
end
|
Instance Method Details
#and_also(*queries) ⇒ Object
749
750
751
|
# File 'lib/couchbase/search_options.rb', line 749
def and_also(*queries)
@queries |= queries.flatten
end
|
#empty? ⇒ Boolean
753
754
755
|
# File 'lib/couchbase/search_options.rb', line 753
def empty?
@queries.empty?
end
|
#to_h ⇒ Hash<Symbol, #to_json>
758
759
760
761
762
763
764
|
# File 'lib/couchbase/search_options.rb', line 758
def to_h
raise Error::InvalidArgument, "compound conjunction query must have sub-queries" if @queries.nil? || @queries.empty?
data = {:conjuncts => @queries.uniq.map(&:to_h)}
data[:boost] = boost if boost
data
end
|