Class: Couchbase::Options::Search
Overview
Options for Cluster#search_query and Cluster#search
Constant Summary collapse
- DEFAULT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Search.new.freeze
Instance Attribute Summary collapse
- #collections ⇒ Array<String>?
- #disable_scoring ⇒ Boolean
- #explain ⇒ Boolean
- #facets ⇒ Hash<String => Cluster::SearchFacet>
- #fields ⇒ Array<String>
- #highlight_fields ⇒ Array<String>
- #highlight_style ⇒ Symbol
- #include_locations ⇒ Boolean
- #limit ⇒ Integer
- #mutation_state ⇒ MutationState readonly private
- #scan_consistency ⇒ Symbol private
- #skip ⇒ Integer
- #sort ⇒ Array<String, Cluster::SearchSort>
- #transcoder ⇒ JsonTranscoder, #decode(String)
Attributes inherited from Base
#client_context, #parent_span, #retry_strategy, #timeout
Instance Method Summary collapse
-
#consistent_with(mutation_state) ⇒ void
Sets the mutation tokens this query should be consistent with.
-
#initialize(limit: nil, skip: nil, explain: false, highlight_style: nil, highlight_fields: nil, fields: nil, mutation_state: nil, disable_scoring: false, include_locations: false, collections: nil, sort: nil, facets: nil, transcoder: JsonTranscoder.new, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ Search
constructor
A new instance of Search.
- #to_backend(show_request: nil) ⇒ Object private
Constructor Details
#initialize(limit: nil, skip: nil, explain: false, highlight_style: nil, highlight_fields: nil, fields: nil, mutation_state: nil, disable_scoring: false, include_locations: false, collections: nil, sort: nil, facets: nil, transcoder: JsonTranscoder.new, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ Search
Returns a new instance of Search.
2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 |
# File 'lib/couchbase/options.rb', line 2367 def initialize(limit: nil, skip: nil, explain: false, highlight_style: nil, highlight_fields: nil, fields: nil, mutation_state: nil, disable_scoring: false, include_locations: false, collections: nil, sort: nil, facets: nil, transcoder: JsonTranscoder.new, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span) @limit = limit @skip = skip @explain = explain @highlight_style = highlight_style @highlight_fields = highlight_fields @fields = fields @disable_scoring = disable_scoring @include_locations = include_locations @collections = collections @sort = sort @facets = facets @transcoder = transcoder @scan_consistency = :not_bounded @mutation_state = mutation_state yield self if block_given? end |
Instance Attribute Details
#collections ⇒ Array<String>?
2334 2335 2336 |
# File 'lib/couchbase/options.rb', line 2334 def collections @collections end |
#disable_scoring ⇒ Boolean
2332 2333 2334 |
# File 'lib/couchbase/options.rb', line 2332 def disable_scoring @disable_scoring end |
#explain ⇒ Boolean
2328 2329 2330 |
# File 'lib/couchbase/options.rb', line 2328 def explain @explain end |
#facets ⇒ Hash<String => Cluster::SearchFacet>
2336 2337 2338 |
# File 'lib/couchbase/options.rb', line 2336 def facets @facets end |
#fields ⇒ Array<String>
2331 2332 2333 |
# File 'lib/couchbase/options.rb', line 2331 def fields @fields end |
#highlight_fields ⇒ Array<String>
2330 2331 2332 |
# File 'lib/couchbase/options.rb', line 2330 def highlight_fields @highlight_fields end |
#highlight_style ⇒ Symbol
2329 2330 2331 |
# File 'lib/couchbase/options.rb', line 2329 def highlight_style @highlight_style end |
#include_locations ⇒ Boolean
2333 2334 2335 |
# File 'lib/couchbase/options.rb', line 2333 def include_locations @include_locations end |
#limit ⇒ Integer
2326 2327 2328 |
# File 'lib/couchbase/options.rb', line 2326 def limit @limit end |
#mutation_state ⇒ MutationState (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2429 2430 2431 |
# File 'lib/couchbase/options.rb', line 2429 def mutation_state @mutation_state end |
#scan_consistency ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2433 2434 2435 |
# File 'lib/couchbase/options.rb', line 2433 def scan_consistency @scan_consistency end |
#skip ⇒ Integer
2327 2328 2329 |
# File 'lib/couchbase/options.rb', line 2327 def skip @skip end |
#sort ⇒ Array<String, Cluster::SearchSort>
2335 2336 2337 |
# File 'lib/couchbase/options.rb', line 2335 def sort @sort end |
#transcoder ⇒ JsonTranscoder, #decode(String)
2337 2338 2339 |
# File 'lib/couchbase/options.rb', line 2337 def transcoder @transcoder end |
Instance Method Details
#consistent_with(mutation_state) ⇒ void
overrides consistency level set by #scan_consistency=
This method returns an undefined value.
Sets the mutation tokens this query should be consistent with
2409 2410 2411 2412 |
# File 'lib/couchbase/options.rb', line 2409 def consistent_with(mutation_state) @scan_consistency = nil if @scan_consistency @mutation_state = mutation_state end |
#to_backend(show_request: nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 |
# File 'lib/couchbase/options.rb', line 2436 def to_backend(show_request: nil) { timeout: Utils::Time.extract_duration(@timeout), limit: @limit, skip: @skip, explain: @explain, disable_scoring: @disable_scoring, include_locations: @include_locations, collections: @collections, highlight_style: @highlight_style, highlight_fields: @highlight_fields, fields: @fields, sort: @sort&.map { |v| JSON.generate(v) }, facets: @facets&.map { |(k, v)| [k, JSON.generate(v)] }, scan_consistency: @scan_consistency, mutation_state: @mutation_state&.to_a, show_request: show_request, } end |