Class: Couchbase::Cluster::SearchQuery::ConjunctionQuery

Inherits:
Couchbase::Cluster::SearchQuery show all
Defined in:
lib/couchbase/search_options.rb

Overview

Result documents must satisfy all of the child queries.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Couchbase::Cluster::SearchQuery

boolean_field, booleans, conjuncts, date_range, disjuncts, doc_id, geo_bounding_box, geo_distance, match, match_all, match_none, match_phrase, numeric_range, phrase, prefix, query_string, regexp, term, term_range, wildcard

Constructor Details

#initialize(*queries) {|self| ... } ⇒ ConjunctionQuery

Returns a new instance of ConjunctionQuery.

Parameters:

Yield Parameters:

[View source]

618
619
620
621
622
# File 'lib/couchbase/search_options.rb', line 618

def initialize(*queries)
  super()
  @queries = queries.flatten
  yield self if block_given?
end

Instance Attribute Details

#boostFloat

Returns:

  • (Float)

613
614
615
# File 'lib/couchbase/search_options.rb', line 613

def boost
  @boost
end

Instance Method Details

#and_also(*queries) ⇒ Object

Parameters:

[View source]

625
626
627
# File 'lib/couchbase/search_options.rb', line 625

def and_also(*queries)
  @queries |= queries.flatten
end

#empty?Boolean

Returns:

  • (Boolean)
[View source]

629
630
631
# File 'lib/couchbase/search_options.rb', line 629

def empty?
  @queries.empty?
end

#to_json(*args) ⇒ String

Returns:

  • (String)

Raises:

  • (ArgumentError)
[View source]

634
635
636
637
638
639
# File 'lib/couchbase/search_options.rb', line 634

def to_json(*args)
  raise ArgumentError, "compound conjunction query must have sub-queries" if @queries.nil? || @queries.empty?
  data = {"conjuncts" => @queries.uniq}
  data["boost"] = boost if boost
  data.to_json(*args)
end