Class: Couchbase::Cluster::SearchQuery::DocIdQuery

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

Overview

Allows to restrict matches to a set of specific documents.

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, geo_polygon, match, match_all, match_none, match_phrase, numeric_range, phrase, prefix, query_string, regexp, term, term_range, wildcard

Constructor Details

#initialize(*doc_ids) {|self| ... } ⇒ DocIdQuery

Returns a new instance of DocIdQuery.

Parameters:

  • doc_ids (String...)

Yield Parameters:



232
233
234
235
236
# File 'lib/couchbase/search_options.rb', line 232

def initialize(*doc_ids)
  super()
  @doc_ids = doc_ids
  yield self if block_given?
end

Instance Attribute Details

#boostFloat

Returns:

  • (Float)


224
225
226
# File 'lib/couchbase/search_options.rb', line 224

def boost
  @boost
end

#fieldString

Returns:

  • (String)


227
228
229
# File 'lib/couchbase/search_options.rb', line 227

def field
  @field
end

Instance Method Details

#to_json(*args) ⇒ String

Returns:

  • (String)


239
240
241
242
243
244
# File 'lib/couchbase/search_options.rb', line 239

def to_json(*args)
  data = {"doc_ids" => @doc_ids.flatten.uniq}
  data["boost"] = boost if boost
  data["field"] = field if field
  data.to_json(*args)
end