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

Inherits:
Couchbase::Cluster::SearchQuery show all
Defined in:
lib/couchbase/search_options.rb,
/Users/sergey.auseyau/code/couchbase-ruby-client/lib/couchbase/search_options.rb
more...

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:

[View source]

254
255
256
257
258
# File 'lib/couchbase/search_options.rb', line 254

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

Instance Attribute Details

#boostFloat

Returns:

  • (Float)

243
244
245
# File 'lib/couchbase/search_options.rb', line 243

def boost
  @boost
end

#fieldString

Returns:

  • (String)

249
250
251
# File 'lib/couchbase/search_options.rb', line 249

def field
  @field
end

#operatornil, ...

Returns:

  • (nil, :or, :and)

246
247
248
# File 'lib/couchbase/search_options.rb', line 246

def operator
  @operator
end

Instance Method Details

#to_json(*args) ⇒ String

Returns:

  • (String)
[View source]

261
262
263
264
265
266
267
# File 'lib/couchbase/search_options.rb', line 261

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