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.
2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 |
# File 'lib/couchbase/options.rb', line 2262 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>?
2229 2230 2231 |
# File 'lib/couchbase/options.rb', line 2229 def collections @collections end |
#disable_scoring ⇒ Boolean
2227 2228 2229 |
# File 'lib/couchbase/options.rb', line 2227 def disable_scoring @disable_scoring end |
#explain ⇒ Boolean
2223 2224 2225 |
# File 'lib/couchbase/options.rb', line 2223 def explain @explain end |
#facets ⇒ Hash<String => Cluster::SearchFacet>
2231 2232 2233 |
# File 'lib/couchbase/options.rb', line 2231 def facets @facets end |
#fields ⇒ Array<String>
2226 2227 2228 |
# File 'lib/couchbase/options.rb', line 2226 def fields @fields end |
#highlight_fields ⇒ Array<String>
2225 2226 2227 |
# File 'lib/couchbase/options.rb', line 2225 def highlight_fields @highlight_fields end |
#highlight_style ⇒ Symbol
2224 2225 2226 |
# File 'lib/couchbase/options.rb', line 2224 def highlight_style @highlight_style end |
#include_locations ⇒ Boolean
2228 2229 2230 |
# File 'lib/couchbase/options.rb', line 2228 def include_locations @include_locations end |
#limit ⇒ Integer
2221 2222 2223 |
# File 'lib/couchbase/options.rb', line 2221 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.
2324 2325 2326 |
# File 'lib/couchbase/options.rb', line 2324 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.
2328 2329 2330 |
# File 'lib/couchbase/options.rb', line 2328 def scan_consistency @scan_consistency end |
#skip ⇒ Integer
2222 2223 2224 |
# File 'lib/couchbase/options.rb', line 2222 def skip @skip end |
#sort ⇒ Array<String, Cluster::SearchSort>
2230 2231 2232 |
# File 'lib/couchbase/options.rb', line 2230 def sort @sort end |
#transcoder ⇒ JsonTranscoder, #decode(String)
2232 2233 2234 |
# File 'lib/couchbase/options.rb', line 2232 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
2304 2305 2306 2307 |
# File 'lib/couchbase/options.rb', line 2304 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.
2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 |
# File 'lib/couchbase/options.rb', line 2331 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 |