couchbase 3.5.1-x86_64-linux → 3.5.2-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/active_support/cache/couchbase_store.rb +4 -1
- data/lib/couchbase/3.1/libcouchbase.so +0 -0
- data/lib/couchbase/3.2/libcouchbase.so +0 -0
- data/lib/couchbase/3.3/libcouchbase.so +0 -0
- data/lib/couchbase/analytics_options.rb +2 -0
- data/lib/couchbase/authenticator.rb +2 -0
- data/lib/couchbase/binary_collection.rb +2 -0
- data/lib/couchbase/binary_collection_options.rb +2 -0
- data/lib/couchbase/bucket.rb +2 -0
- data/lib/couchbase/cluster.rb +2 -0
- data/lib/couchbase/collection.rb +3 -1
- data/lib/couchbase/collection_options.rb +2 -0
- data/lib/couchbase/config_profiles.rb +2 -0
- data/lib/couchbase/configuration.rb +2 -0
- data/lib/couchbase/datastructures/couchbase_list.rb +4 -4
- data/lib/couchbase/datastructures/couchbase_map.rb +4 -4
- data/lib/couchbase/datastructures/couchbase_queue.rb +4 -4
- data/lib/couchbase/datastructures/couchbase_set.rb +4 -4
- data/lib/couchbase/datastructures.rb +2 -0
- data/lib/couchbase/diagnostics.rb +2 -0
- data/lib/couchbase/errors.rb +46 -8
- data/lib/couchbase/json_transcoder.rb +2 -0
- data/lib/couchbase/key_value_scan.rb +2 -0
- data/lib/couchbase/libcouchbase.rb +1 -1
- data/lib/couchbase/logger.rb +2 -0
- data/lib/couchbase/management/analytics_index_manager.rb +2 -0
- data/lib/couchbase/management/bucket_manager.rb +2 -0
- data/lib/couchbase/management/collection_manager.rb +2 -0
- data/lib/couchbase/management/collection_query_index_manager.rb +2 -0
- data/lib/couchbase/management/query_index_manager.rb +2 -0
- data/lib/couchbase/management/scope_search_index_manager.rb +2 -0
- data/lib/couchbase/management/search_index_manager.rb +2 -0
- data/lib/couchbase/management/user_manager.rb +2 -0
- data/lib/couchbase/management/view_index_manager.rb +2 -0
- data/lib/couchbase/management.rb +2 -0
- data/lib/couchbase/mutation_state.rb +2 -0
- data/lib/couchbase/options.rb +2 -0
- data/lib/couchbase/protostellar/request_generator/kv.rb +1 -1
- data/lib/couchbase/query_options.rb +2 -0
- data/lib/couchbase/railtie.rb +2 -0
- data/lib/couchbase/raw_binary_transcoder.rb +2 -0
- data/lib/couchbase/raw_json_transcoder.rb +2 -0
- data/lib/couchbase/raw_string_transcoder.rb +2 -0
- data/lib/couchbase/scope.rb +2 -0
- data/lib/couchbase/search_options.rb +91 -63
- data/lib/couchbase/subdoc.rb +5 -3
- data/lib/couchbase/transcoder_flags.rb +2 -0
- data/lib/couchbase/utils/generic_logger_adapter.rb +3 -1
- data/lib/couchbase/utils/stdlib_logger_adapter.rb +2 -0
- data/lib/couchbase/utils/time.rb +3 -1
- data/lib/couchbase/utils.rb +2 -0
- data/lib/couchbase/version.rb +3 -1
- data/lib/couchbase/view_options.rb +2 -0
- data/lib/couchbase.rb +2 -0
- data/lib/rails/generators/couchbase/config/config_generator.rb +2 -0
- metadata +7 -8
- data/lib/couchbase/3.0/libcouchbase.so +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 729671b66b39c776edd0098a2a228c93343ba8aed1ce7d540ce679e74d1f4757
|
4
|
+
data.tar.gz: cdc54351b35920c5aa046444a5c644f44a1f09be25d47813d9d3ca3b632c8854
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7191118f54a47faaa68eb0087460d60ba4caa368d8e680beb4ef766607d463a2d20b81d578c56affd25382101a229e9d2ed500198f1b556c40e455f43821705
|
7
|
+
data.tar.gz: fbc644e94662cfa69ca36f857b9e66f8a9ec013cfb6f0db38f979e838f6ef7bb93718f90aee69a927bd6c642a87db99faace6037aed9078d12ae7786da4011a4
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2020-2021 Couchbase, Inc.
|
2
4
|
#
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -106,7 +108,8 @@ module ActiveSupport
|
|
106
108
|
operation_options = ::Couchbase::Options::Query(named_parameters: {"pattern" => pattern}, metrics: true)
|
107
109
|
operation_options.consistent_with(::Couchbase::MutationState.new(@last_mutation_token)) if @last_mutation_token
|
108
110
|
begin
|
109
|
-
result = cluster.query("DELETE FROM #{scope_qualifier}
|
111
|
+
result = cluster.query("DELETE FROM #{scope_qualifier} cache_store_ WHERE REGEXP_MATCHES(META(cache_store_).id, $pattern)",
|
112
|
+
operation_options)
|
110
113
|
result.meta_data.metrics.mutation_count
|
111
114
|
rescue ::Couchbase::Error::ParsingFailure, ::Couchbase::Error::ServiceNotAvailable
|
112
115
|
raise NotImplementedError, "The server does not support delete_matched operation"
|
Binary file
|
Binary file
|
Binary file
|
data/lib/couchbase/bucket.rb
CHANGED
data/lib/couchbase/cluster.rb
CHANGED
data/lib/couchbase/collection.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2020-2021 Couchbase, Inc.
|
2
4
|
#
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -136,7 +138,7 @@ module Couchbase
|
|
136
138
|
# @return [GetResult]
|
137
139
|
def get_and_lock(id, lock_time, options = Options::GetAndLock::DEFAULT)
|
138
140
|
resp = @backend.document_get_and_lock(bucket_name, @scope_name, @name, id,
|
139
|
-
lock_time.respond_to?(:in_seconds) ? lock_time.
|
141
|
+
lock_time.respond_to?(:in_seconds) ? lock_time.in_seconds : lock_time,
|
140
142
|
options.to_backend)
|
141
143
|
GetResult.new do |res|
|
142
144
|
res.transcoder = options.transcoder
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2020-2021 Couchbase, Inc.
|
2
4
|
#
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -42,7 +44,7 @@ module Couchbase
|
|
42
44
|
# @yieldparam [Object] item
|
43
45
|
#
|
44
46
|
# @return [CouchbaseList, Enumerable]
|
45
|
-
def each
|
47
|
+
def each(&)
|
46
48
|
if block_given?
|
47
49
|
begin
|
48
50
|
result = @collection.get(@id, @options.get_options)
|
@@ -52,9 +54,7 @@ module Couchbase
|
|
52
54
|
current = []
|
53
55
|
@cas = 0
|
54
56
|
end
|
55
|
-
current.each
|
56
|
-
yield entry
|
57
|
-
end
|
57
|
+
current.each(&)
|
58
58
|
self
|
59
59
|
else
|
60
60
|
enum_for(:each)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2020-2021 Couchbase, Inc.
|
2
4
|
#
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -42,7 +44,7 @@ module Couchbase
|
|
42
44
|
# @yieldparam [Object] item
|
43
45
|
#
|
44
46
|
# @return [CouchbaseMap, Enumerable]
|
45
|
-
def each
|
47
|
+
def each(&)
|
46
48
|
if block_given?
|
47
49
|
begin
|
48
50
|
result = @collection.get(@id, @options.get_options)
|
@@ -52,9 +54,7 @@ module Couchbase
|
|
52
54
|
current = []
|
53
55
|
@cas = 0
|
54
56
|
end
|
55
|
-
current.each
|
56
|
-
yield key, value
|
57
|
-
end
|
57
|
+
current.each(&)
|
58
58
|
self
|
59
59
|
else
|
60
60
|
enum_for(:each)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2020-2021 Couchbase, Inc.
|
2
4
|
#
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -42,7 +44,7 @@ module Couchbase
|
|
42
44
|
# @yieldparam [Object] item
|
43
45
|
#
|
44
46
|
# @return [CouchbaseQueue, Enumerable]
|
45
|
-
def each
|
47
|
+
def each(&)
|
46
48
|
if block_given?
|
47
49
|
begin
|
48
50
|
result = @collection.get(@id, @options.get_options)
|
@@ -52,9 +54,7 @@ module Couchbase
|
|
52
54
|
current = []
|
53
55
|
@cas = 0
|
54
56
|
end
|
55
|
-
current.each
|
56
|
-
yield entry
|
57
|
-
end
|
57
|
+
current.each(&)
|
58
58
|
self
|
59
59
|
else
|
60
60
|
enum_for(:each)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2020-2021 Couchbase, Inc.
|
2
4
|
#
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -42,7 +44,7 @@ module Couchbase
|
|
42
44
|
# @yieldparam [Object] item
|
43
45
|
#
|
44
46
|
# @return [CouchbaseSet, Enumerable]
|
45
|
-
def each
|
47
|
+
def each(&)
|
46
48
|
if block_given?
|
47
49
|
begin
|
48
50
|
result = @collection.get(@id, @options.get_options)
|
@@ -52,9 +54,7 @@ module Couchbase
|
|
52
54
|
current = []
|
53
55
|
@cas = 0
|
54
56
|
end
|
55
|
-
current.each
|
56
|
-
yield entry
|
57
|
-
end
|
57
|
+
current.each(&)
|
58
58
|
self
|
59
59
|
else
|
60
60
|
enum_for(:each)
|
data/lib/couchbase/errors.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2020-2023 Couchbase, Inc.
|
2
4
|
#
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -18,30 +20,66 @@ module Couchbase
|
|
18
20
|
# This namespace contains all error types that the library might raise.
|
19
21
|
module Error
|
20
22
|
class CouchbaseError < StandardError
|
21
|
-
# @return [Hash] attributes associated with the error
|
23
|
+
# @return [Hash, nil] attributes associated with the error
|
22
24
|
attr_reader :context
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
+
# @return [CouchbaseError, nil] original error that caused this one
|
27
|
+
attr_reader :cause
|
28
|
+
|
29
|
+
def initialize(msg = nil, context = nil, cause = nil)
|
30
|
+
@context = context
|
31
|
+
@cause = cause
|
26
32
|
super(msg)
|
27
33
|
end
|
28
34
|
|
35
|
+
def context=(context)
|
36
|
+
return unless context.is_a?(String)
|
37
|
+
|
38
|
+
@context =
|
39
|
+
begin
|
40
|
+
JSON.parse(context)
|
41
|
+
rescue StandardError
|
42
|
+
context
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
29
46
|
def to_s
|
30
|
-
|
47
|
+
result = super
|
48
|
+
result << ", context=#{JSON.generate(@context)}" if @context
|
49
|
+
result << ", cause=#{@cause}" if @cause
|
50
|
+
result
|
31
51
|
end
|
32
52
|
end
|
33
53
|
|
34
54
|
class InvalidArgument < ArgumentError
|
35
|
-
# @return [Hash] attributes associated with the error
|
55
|
+
# @return [Hash, nil] attributes associated with the error
|
36
56
|
attr_reader :context
|
37
57
|
|
38
|
-
|
39
|
-
|
58
|
+
# @return [CouchbaseError, nil] original error that caused this one
|
59
|
+
attr_reader :cause
|
60
|
+
|
61
|
+
def initialize(msg = nil, context = nil, cause = nil)
|
62
|
+
@context = context
|
63
|
+
@cause = cause
|
40
64
|
super(msg)
|
41
65
|
end
|
42
66
|
|
67
|
+
def context=(context)
|
68
|
+
return unless context.is_a?(String)
|
69
|
+
|
70
|
+
@context =
|
71
|
+
begin
|
72
|
+
JSON.parse(context)
|
73
|
+
rescue StandardError
|
74
|
+
context
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
43
78
|
def to_s
|
44
|
-
|
79
|
+
result = super
|
80
|
+
result << ", context=#{JSON.generate(@context)}" if @context
|
81
|
+
result << ", cause=#{@cause}" if @cause
|
82
|
+
result
|
45
83
|
end
|
46
84
|
end
|
47
85
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
begin
|
2
2
|
require_relative "#{RUBY_VERSION[/(\d+\.\d+)/]}/libcouchbase"
|
3
3
|
rescue LoadError
|
4
|
-
raise LoadError, "unable to load couchbase extension for Ruby #{RUBY_VERSION}. Only available for 3.
|
4
|
+
raise LoadError, "unable to load couchbase extension for Ruby #{RUBY_VERSION}. Only available for 3.1, 3.2, 3.3. " \
|
5
5
|
"Try to install couchbase from sources with 'gem install --platform ruby couchbase'"
|
6
6
|
end
|
data/lib/couchbase/logger.rb
CHANGED
data/lib/couchbase/management.rb
CHANGED
data/lib/couchbase/options.rb
CHANGED
@@ -110,7 +110,7 @@ module Couchbase
|
|
110
110
|
proto_req = Generated::KV::V1::GetAndLockRequest.new(
|
111
111
|
**location,
|
112
112
|
key: id,
|
113
|
-
lock_time: lock_time.respond_to?(:in_seconds) ? lock_time.
|
113
|
+
lock_time: lock_time.respond_to?(:in_seconds) ? lock_time.in_seconds : lock_time
|
114
114
|
)
|
115
115
|
|
116
116
|
create_kv_request(proto_req, :get_and_lock, options)
|
data/lib/couchbase/railtie.rb
CHANGED
data/lib/couchbase/scope.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2020-2021 Couchbase, Inc.
|
2
4
|
#
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -92,8 +94,8 @@ module Couchbase
|
|
92
94
|
# @yieldparam [MatchQuery] query
|
93
95
|
#
|
94
96
|
# @return [MatchQuery]
|
95
|
-
def self.match(match, &
|
96
|
-
MatchQuery.new(match, &
|
97
|
+
def self.match(match, &)
|
98
|
+
MatchQuery.new(match, &)
|
97
99
|
end
|
98
100
|
|
99
101
|
# A match query analyzes the input text and uses that analyzed text to query the index.
|
@@ -143,8 +145,8 @@ module Couchbase
|
|
143
145
|
# @yieldparam [MatchPhraseQuery] query
|
144
146
|
#
|
145
147
|
# @return [MatchPhraseQuery]
|
146
|
-
def self.match_phrase(match_phrase, &
|
147
|
-
MatchPhraseQuery.new(match_phrase, &
|
148
|
+
def self.match_phrase(match_phrase, &)
|
149
|
+
MatchPhraseQuery.new(match_phrase, &)
|
148
150
|
end
|
149
151
|
|
150
152
|
# The input text is analyzed and a phrase query is built with the terms resulting from the analysis.
|
@@ -183,8 +185,8 @@ module Couchbase
|
|
183
185
|
# @yieldparam [RegexpQuery] query
|
184
186
|
#
|
185
187
|
# @return [RegexpQuery]
|
186
|
-
def self.regexp(regexp, &
|
187
|
-
RegexpQuery.new(regexp, &
|
188
|
+
def self.regexp(regexp, &)
|
189
|
+
RegexpQuery.new(regexp, &)
|
188
190
|
end
|
189
191
|
|
190
192
|
# Finds documents containing terms that match the specified regular expression.
|
@@ -219,8 +221,8 @@ module Couchbase
|
|
219
221
|
# @yieldparam [QueryStringQuery] query
|
220
222
|
#
|
221
223
|
# @return [QueryStringQuery]
|
222
|
-
def self.query_string(query_string, &
|
223
|
-
QueryStringQuery.new(query_string, &
|
224
|
+
def self.query_string(query_string, &)
|
225
|
+
QueryStringQuery.new(query_string, &)
|
224
226
|
end
|
225
227
|
|
226
228
|
# The query string query allows humans to describe complex queries using a simple syntax.
|
@@ -251,8 +253,8 @@ module Couchbase
|
|
251
253
|
# @yieldparam [WildcardQuery] query
|
252
254
|
#
|
253
255
|
# @return [WildcardQuery]
|
254
|
-
def self.wildcard(wildcard, &
|
255
|
-
WildcardQuery.new(wildcard, &
|
256
|
+
def self.wildcard(wildcard, &)
|
257
|
+
WildcardQuery.new(wildcard, &)
|
256
258
|
end
|
257
259
|
|
258
260
|
# Interprets * and ? wildcards as found in a lot of applications, for an easy implementation of such a search feature.
|
@@ -354,8 +356,8 @@ module Couchbase
|
|
354
356
|
# @yieldparam [DateRangeQuery] query
|
355
357
|
#
|
356
358
|
# @return [DateRangeQuery]
|
357
|
-
def self.date_range(&
|
358
|
-
DateRangeQuery.new(&
|
359
|
+
def self.date_range(&)
|
360
|
+
DateRangeQuery.new(&)
|
359
361
|
end
|
360
362
|
|
361
363
|
# The date range query finds documents containing a date value in the specified field within the specified range.
|
@@ -402,11 +404,11 @@ module Couchbase
|
|
402
404
|
yield self if block_given?
|
403
405
|
end
|
404
406
|
|
405
|
-
DATE_FORMAT_RFC3339 = "%Y-%m-%dT%H:%M:%S%:z"
|
407
|
+
DATE_FORMAT_RFC3339 = "%Y-%m-%dT%H:%M:%S%:z"
|
406
408
|
|
407
409
|
# @return [Hash<Symbol, #to_json>]
|
408
410
|
def to_h
|
409
|
-
raise
|
411
|
+
raise Error::InvalidArgument, "either start_time or end_time must be set for DateRangeQuery" if @start_time.nil? && @end_time.nil?
|
410
412
|
|
411
413
|
data = {}
|
412
414
|
data[:boost] = boost if boost
|
@@ -437,8 +439,8 @@ module Couchbase
|
|
437
439
|
# @yieldparam [NumericRangeQuery] query
|
438
440
|
#
|
439
441
|
# @return [NumericRangeQuery]
|
440
|
-
def self.numeric_range(&
|
441
|
-
NumericRangeQuery.new(&
|
442
|
+
def self.numeric_range(&)
|
443
|
+
NumericRangeQuery.new(&)
|
442
444
|
end
|
443
445
|
|
444
446
|
# The numeric range query finds documents containing a numeric value in the specified field within the specified range.
|
@@ -483,7 +485,7 @@ module Couchbase
|
|
483
485
|
|
484
486
|
# @return [Hash<Symbol, #to_json>]
|
485
487
|
def to_h
|
486
|
-
raise
|
488
|
+
raise Error::InvalidArgument, "either min or max must be set for NumericRangeQuery" if @min.nil? && @max.nil?
|
487
489
|
|
488
490
|
data = {}
|
489
491
|
data[:boost] = boost if boost
|
@@ -505,8 +507,8 @@ module Couchbase
|
|
505
507
|
# @yieldparam [TermRangeQuery] query
|
506
508
|
#
|
507
509
|
# @return [TermRangeQuery]
|
508
|
-
def self.term_range(&
|
509
|
-
TermRangeQuery.new(&
|
510
|
+
def self.term_range(&)
|
511
|
+
TermRangeQuery.new(&)
|
510
512
|
end
|
511
513
|
|
512
514
|
# The term range query finds documents containing a string value in the specified field within the specified range.
|
@@ -551,7 +553,7 @@ module Couchbase
|
|
551
553
|
|
552
554
|
# @return [Hash<Symbol, #to_json>]
|
553
555
|
def to_h
|
554
|
-
raise
|
556
|
+
raise Error::InvalidArgument, "either min or max must be set for TermRangeQuery" if @min.nil? && @max.nil?
|
555
557
|
|
556
558
|
data = {}
|
557
559
|
data[:boost] = boost if boost
|
@@ -577,8 +579,8 @@ module Couchbase
|
|
577
579
|
# @param [String] distance how big is area (number with units)
|
578
580
|
#
|
579
581
|
# @return [GeoDistanceQuery]
|
580
|
-
def self.geo_distance(longitude, latitude, distance, &
|
581
|
-
GeoDistanceQuery.new(longitude, latitude, distance, &
|
582
|
+
def self.geo_distance(longitude, latitude, distance, &)
|
583
|
+
GeoDistanceQuery.new(longitude, latitude, distance, &)
|
582
584
|
end
|
583
585
|
|
584
586
|
# Finds `geopoint` indexed matches around a point with the given distance.
|
@@ -623,8 +625,8 @@ module Couchbase
|
|
623
625
|
# @param [Float] bottom_right_latitude
|
624
626
|
#
|
625
627
|
# @return [GeoBoundingBoxQuery]
|
626
|
-
def self.geo_bounding_box(top_left_longitude, top_left_latitude, bottom_right_longitude, bottom_right_latitude, &
|
627
|
-
GeoBoundingBoxQuery.new(top_left_longitude, top_left_latitude, bottom_right_longitude, bottom_right_latitude, &
|
628
|
+
def self.geo_bounding_box(top_left_longitude, top_left_latitude, bottom_right_longitude, bottom_right_latitude, &)
|
629
|
+
GeoBoundingBoxQuery.new(top_left_longitude, top_left_latitude, bottom_right_longitude, bottom_right_latitude, &)
|
628
630
|
end
|
629
631
|
|
630
632
|
# Finds `geopoint` indexed matches in a given bounding box.
|
@@ -688,8 +690,8 @@ module Couchbase
|
|
688
690
|
# @return [GeoPolygonQuery]
|
689
691
|
#
|
690
692
|
# @!macro uncommitted
|
691
|
-
def self.geo_polygon(coordinates, &
|
692
|
-
GeoPolygonQuery.new(coordinates, &
|
693
|
+
def self.geo_polygon(coordinates, &)
|
694
|
+
GeoPolygonQuery.new(coordinates, &)
|
693
695
|
end
|
694
696
|
|
695
697
|
# A search query which allows to match inside a geo polygon.
|
@@ -754,7 +756,7 @@ module Couchbase
|
|
754
756
|
|
755
757
|
# @return [Hash<Symbol, #to_json>]
|
756
758
|
def to_h
|
757
|
-
raise
|
759
|
+
raise Error::InvalidArgument, "compound conjunction query must have sub-queries" if @queries.nil? || @queries.empty?
|
758
760
|
|
759
761
|
data = {:conjuncts => @queries.uniq.map(&:to_h)}
|
760
762
|
data[:boost] = boost if boost
|
@@ -799,11 +801,11 @@ module Couchbase
|
|
799
801
|
|
800
802
|
# @return [Hash<Symbol, #to_json>]
|
801
803
|
def to_h
|
802
|
-
raise
|
804
|
+
raise Error::InvalidArgument, "compound disjunction query must have sub-queries" if @queries.nil? || @queries.empty?
|
803
805
|
|
804
806
|
data = {:disjuncts => @queries.uniq.map(&:to_h)}
|
805
807
|
if min
|
806
|
-
raise
|
808
|
+
raise Error::InvalidArgument, "disjunction query has fewer sub-queries than configured minimum" if @queries.size < min
|
807
809
|
|
808
810
|
data[:min] = min
|
809
811
|
end
|
@@ -817,8 +819,8 @@ module Couchbase
|
|
817
819
|
# @yieldparam [BooleanQuery] query
|
818
820
|
#
|
819
821
|
# @return [BooleanQuery]
|
820
|
-
def self.booleans(&
|
821
|
-
BooleanQuery.new(&
|
822
|
+
def self.booleans(&)
|
823
|
+
BooleanQuery.new(&)
|
822
824
|
end
|
823
825
|
|
824
826
|
# The boolean query is a useful combination of conjunction and disjunction queries.
|
@@ -828,7 +830,7 @@ module Couchbase
|
|
828
830
|
|
829
831
|
# @yieldparam [BooleanQuery] self
|
830
832
|
def initialize
|
831
|
-
super
|
833
|
+
super
|
832
834
|
@must = ConjunctionQuery.new
|
833
835
|
@must_not = DisjunctionQuery.new
|
834
836
|
@should = DisjunctionQuery.new
|
@@ -861,7 +863,10 @@ module Couchbase
|
|
861
863
|
|
862
864
|
# @return [Hash<Symbol, #to_json>]
|
863
865
|
def to_h
|
864
|
-
|
866
|
+
if @must.empty? && @must_not.empty? && @should.empty?
|
867
|
+
raise Error::InvalidArgument,
|
868
|
+
"BooleanQuery must have at least one non-empty sub-query"
|
869
|
+
end
|
865
870
|
|
866
871
|
data = {}
|
867
872
|
data[:must] = @must.to_h unless @must.empty?
|
@@ -878,8 +883,8 @@ module Couchbase
|
|
878
883
|
# @param [String] term
|
879
884
|
#
|
880
885
|
# @return [TermQuery]
|
881
|
-
def self.term(term, &
|
882
|
-
TermQuery.new(term, &
|
886
|
+
def self.term(term, &)
|
887
|
+
TermQuery.new(term, &)
|
883
888
|
end
|
884
889
|
|
885
890
|
# A query that looks for **exact** matches of the term in the index (no analyzer, no stemming). Useful to check what the actual
|
@@ -925,8 +930,8 @@ module Couchbase
|
|
925
930
|
# @param [String] prefix
|
926
931
|
#
|
927
932
|
# @return [PrefixQuery]
|
928
|
-
def self.prefix(prefix, &
|
929
|
-
PrefixQuery.new(prefix, &
|
933
|
+
def self.prefix(prefix, &)
|
934
|
+
PrefixQuery.new(prefix, &)
|
930
935
|
end
|
931
936
|
|
932
937
|
# The prefix query finds documents containing terms that start with the provided prefix. Usual better alternative is `MatchQuery`.
|
@@ -999,15 +1004,15 @@ module Couchbase
|
|
999
1004
|
# @yieldparam [MatchAllQuery] query
|
1000
1005
|
#
|
1001
1006
|
# @return [MatchAllQuery]
|
1002
|
-
def self.match_all(&
|
1003
|
-
MatchAllQuery.new(&
|
1007
|
+
def self.match_all(&)
|
1008
|
+
MatchAllQuery.new(&)
|
1004
1009
|
end
|
1005
1010
|
|
1006
1011
|
# A query that matches all indexed documents.
|
1007
1012
|
class MatchAllQuery < SearchQuery
|
1008
1013
|
# @yieldparam [MatchAllQuery] self
|
1009
1014
|
def initialize
|
1010
|
-
super
|
1015
|
+
super
|
1011
1016
|
yield self if block_given?
|
1012
1017
|
end
|
1013
1018
|
|
@@ -1022,15 +1027,15 @@ module Couchbase
|
|
1022
1027
|
# @yieldparam [MatchNoneQuery] query
|
1023
1028
|
#
|
1024
1029
|
# @return [MatchNoneQuery]
|
1025
|
-
def self.match_none(&
|
1026
|
-
MatchNoneQuery.new(&
|
1030
|
+
def self.match_none(&)
|
1031
|
+
MatchNoneQuery.new(&)
|
1027
1032
|
end
|
1028
1033
|
|
1029
1034
|
# A query that matches nothing.
|
1030
1035
|
class MatchNoneQuery < SearchQuery
|
1031
1036
|
# @yieldparam [MatchNoneQuery] self
|
1032
1037
|
def initialize
|
1033
|
-
super
|
1038
|
+
super
|
1034
1039
|
yield self if block_given?
|
1035
1040
|
end
|
1036
1041
|
|
@@ -1054,6 +1059,8 @@ module Couchbase
|
|
1054
1059
|
|
1055
1060
|
# @api private
|
1056
1061
|
def to_backend
|
1062
|
+
raise Error::InvalidArgument, "Vector search requires at least one vector query" if @vector_queries.empty?
|
1063
|
+
|
1057
1064
|
{vector_queries: @vector_queries.map(&:to_h).to_json}.merge(@options.to_backend)
|
1058
1065
|
end
|
1059
1066
|
end
|
@@ -1068,13 +1075,23 @@ module Couchbase
|
|
1068
1075
|
|
1069
1076
|
# Constructs a +VectorQuery+ instance
|
1070
1077
|
#
|
1071
|
-
# @
|
1072
|
-
#
|
1078
|
+
# @overload initialize(vector_field_name, vector_query)
|
1079
|
+
# @param [String] vector_field_name the document field that contains the vector.
|
1080
|
+
# @param [Array<Float>] vector_query the vector query.
|
1073
1081
|
#
|
1074
|
-
# @
|
1082
|
+
# @overload initialize(vector_field_name, base64_vector_query)
|
1083
|
+
# @param [String] vector_field_name the document field that contains the vector.
|
1084
|
+
# @param [String] base64_vector_query the vector query represented as a base64-encoded sequence of little-endian IEEE 754 floats.
|
1085
|
+
#
|
1086
|
+
# @yieldparam [VectorQuery] self
|
1075
1087
|
def initialize(vector_field_name, vector_query)
|
1076
1088
|
@vector_field_name = vector_field_name
|
1077
|
-
|
1089
|
+
|
1090
|
+
if vector_query.respond_to?(:to_str)
|
1091
|
+
@base64_vector_query = vector_query.to_str
|
1092
|
+
else
|
1093
|
+
@vector_query = vector_query
|
1094
|
+
end
|
1078
1095
|
|
1079
1096
|
yield self if block_given?
|
1080
1097
|
end
|
@@ -1086,12 +1103,23 @@ module Couchbase
|
|
1086
1103
|
"Number of candidates must be at least 1, #{num_candidates} given"
|
1087
1104
|
end
|
1088
1105
|
|
1089
|
-
{
|
1106
|
+
h = {
|
1090
1107
|
field: @vector_field_name,
|
1091
1108
|
vector: @vector_query,
|
1109
|
+
vector_base64: @base64_vector_query,
|
1092
1110
|
k: num_candidates || 3,
|
1093
1111
|
boost: boost,
|
1094
1112
|
}.compact
|
1113
|
+
|
1114
|
+
raise Error::InvalidArgument, "The vector cannot be nil" if !h.include?(:vector) && !h.include?(:vector_base64)
|
1115
|
+
raise Error::InvalidArgument, "The vector query cannot be an empty array" if h.include?(:vector) && h[:vector].empty?
|
1116
|
+
|
1117
|
+
if h.include?(:vector_base64) && h[:vector_base64].empty?
|
1118
|
+
raise Error::InvalidArgument,
|
1119
|
+
"The base64-encoded vector query cannot be empty"
|
1120
|
+
end
|
1121
|
+
|
1122
|
+
h
|
1095
1123
|
end
|
1096
1124
|
|
1097
1125
|
# @api private
|
@@ -1103,21 +1131,21 @@ module Couchbase
|
|
1103
1131
|
class SearchSort
|
1104
1132
|
# @yieldparam [SearchSortScore]
|
1105
1133
|
# @return [SearchSortScore]
|
1106
|
-
def self.score(&
|
1107
|
-
SearchSortScore.new(&
|
1134
|
+
def self.score(&)
|
1135
|
+
SearchSortScore.new(&)
|
1108
1136
|
end
|
1109
1137
|
|
1110
1138
|
# @yieldparam [SearchSortId]
|
1111
1139
|
# @return [SearchSortScore]
|
1112
|
-
def self.id(&
|
1113
|
-
SearchSortId.new(&
|
1140
|
+
def self.id(&)
|
1141
|
+
SearchSortId.new(&)
|
1114
1142
|
end
|
1115
1143
|
|
1116
1144
|
# @param [String] name field name
|
1117
1145
|
# @yieldparam [SearchSortField]
|
1118
1146
|
# @return [SearchSortField]
|
1119
|
-
def self.field(name, &
|
1120
|
-
SearchSortField.new(name, &
|
1147
|
+
def self.field(name, &)
|
1148
|
+
SearchSortField.new(name, &)
|
1121
1149
|
end
|
1122
1150
|
|
1123
1151
|
# @param [String] name field name
|
@@ -1125,8 +1153,8 @@ module Couchbase
|
|
1125
1153
|
# @param [Float] latitude
|
1126
1154
|
# @yieldparam [SearchSortField]
|
1127
1155
|
# @return [SearchSortGeoDistance]
|
1128
|
-
def self.geo_distance(name, longitude, latitude, &
|
1129
|
-
SearchSortGeoDistance.new(name, longitude, latitude, &
|
1156
|
+
def self.geo_distance(name, longitude, latitude, &)
|
1157
|
+
SearchSortGeoDistance.new(name, longitude, latitude, &)
|
1130
1158
|
end
|
1131
1159
|
|
1132
1160
|
class SearchSortScore < SearchSort
|
@@ -1229,20 +1257,20 @@ module Couchbase
|
|
1229
1257
|
class SearchFacet
|
1230
1258
|
# @param [String] field_name
|
1231
1259
|
# @return [SearchFacetTerm]
|
1232
|
-
def self.term(field_name, &
|
1233
|
-
SearchFacetTerm.new(field_name, &
|
1260
|
+
def self.term(field_name, &)
|
1261
|
+
SearchFacetTerm.new(field_name, &)
|
1234
1262
|
end
|
1235
1263
|
|
1236
1264
|
# @param [String] field_name
|
1237
1265
|
# @return [SearchFacetNumericRange]
|
1238
|
-
def self.numeric_range(field_name, &
|
1239
|
-
SearchFacetNumericRange.new(field_name, &
|
1266
|
+
def self.numeric_range(field_name, &)
|
1267
|
+
SearchFacetNumericRange.new(field_name, &)
|
1240
1268
|
end
|
1241
1269
|
|
1242
1270
|
# @param [String] field_name
|
1243
1271
|
# @return [SearchFacetDateRange]
|
1244
|
-
def self.date_range(field_name, &
|
1245
|
-
SearchFacetDateRange.new(field_name, &
|
1272
|
+
def self.date_range(field_name, &)
|
1273
|
+
SearchFacetDateRange.new(field_name, &)
|
1246
1274
|
end
|
1247
1275
|
|
1248
1276
|
class SearchFacetTerm
|
@@ -1306,7 +1334,7 @@ module Couchbase
|
|
1306
1334
|
yield self if block_given?
|
1307
1335
|
end
|
1308
1336
|
|
1309
|
-
DATE_FORMAT_RFC3339 = "%Y-%m-%dT%H:%M:%S%:z"
|
1337
|
+
DATE_FORMAT_RFC3339 = "%Y-%m-%dT%H:%M:%S%:z"
|
1310
1338
|
|
1311
1339
|
# @param [String] name the name of the range
|
1312
1340
|
# @param [Time, String, nil] start_time lower bound of the range (pass +nil+ if there is no lower bound)
|
data/lib/couchbase/subdoc.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2020-2021 Couchbase, Inc.
|
2
4
|
#
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -245,9 +247,9 @@ module Couchbase
|
|
245
247
|
@expand_macros
|
246
248
|
end
|
247
249
|
|
248
|
-
CAS = "${Mutation.CAS}"
|
249
|
-
SEQ_NO = "${Mutation.seqno}"
|
250
|
-
VALUE_CRC32C = "${Mutation.value_crc32c}"
|
250
|
+
CAS = "${Mutation.CAS}"
|
251
|
+
SEQ_NO = "${Mutation.seqno}"
|
252
|
+
VALUE_CRC32C = "${Mutation.value_crc32c}"
|
251
253
|
|
252
254
|
attr_reader :type
|
253
255
|
attr_reader :path
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2021 Couchbase, Inc.
|
2
4
|
# Copyright 2020-Present Couchbase, Inc.
|
3
5
|
#
|
@@ -18,7 +20,7 @@ require "time"
|
|
18
20
|
module Couchbase
|
19
21
|
module Utils
|
20
22
|
class GenericLoggerAdapter
|
21
|
-
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%6N"
|
23
|
+
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%6N"
|
22
24
|
|
23
25
|
def initialize(logger, verbose: false)
|
24
26
|
@logger = logger
|
data/lib/couchbase/utils/time.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2020-2021 Couchbase, Inc.
|
2
4
|
#
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -59,7 +61,7 @@ module Couchbase
|
|
59
61
|
return number_or_duration if number_or_duration.class == Integer # rubocop:disable Style/ClassEqualityComparison avoid overrides of #is_a?, #kind_of?
|
60
62
|
|
61
63
|
if number_or_duration.respond_to?(:in_milliseconds)
|
62
|
-
number_or_duration.
|
64
|
+
number_or_duration.in_milliseconds
|
63
65
|
else
|
64
66
|
number_or_duration
|
65
67
|
end.to_i
|
data/lib/couchbase/utils.rb
CHANGED
data/lib/couchbase/version.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2020-2021 Couchbase, Inc.
|
2
4
|
#
|
3
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -19,5 +21,5 @@ module Couchbase
|
|
19
21
|
# $ ruby -rcouchbase -e 'pp Couchbase::VERSION'
|
20
22
|
# {:sdk=>"3.4.0", :ruby_abi=>"3.1.0", :revision=>"416fe68e6029ec8a4c40611cf6e6b30d3b90d20f"}
|
21
23
|
VERSION = {} unless defined?(VERSION) # rubocop:disable Style/MutableConstant
|
22
|
-
VERSION.update(:sdk => "3.5.
|
24
|
+
VERSION.update(:sdk => "3.5.2")
|
23
25
|
end
|
data/lib/couchbase.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.2
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- Sergey Avseyev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grpc
|
@@ -36,7 +36,6 @@ files:
|
|
36
36
|
- ext/extconf.rb
|
37
37
|
- lib/active_support/cache/couchbase_store.rb
|
38
38
|
- lib/couchbase.rb
|
39
|
-
- lib/couchbase/3.0/libcouchbase.so
|
40
39
|
- lib/couchbase/3.1/libcouchbase.so
|
41
40
|
- lib/couchbase/3.2/libcouchbase.so
|
42
41
|
- lib/couchbase/3.3/libcouchbase.so
|
@@ -162,9 +161,9 @@ metadata:
|
|
162
161
|
homepage_uri: https://docs.couchbase.com/ruby-sdk/current/hello-world/start-using-sdk.html
|
163
162
|
bug_tracker_uri: https://couchbase.com/issues/browse/RCBC
|
164
163
|
mailing_list_uri: https://forums.couchbase.com/c/ruby-sdk
|
165
|
-
source_code_uri: https://github.com/couchbase/couchbase-ruby-client/tree/3.5.
|
166
|
-
changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases/tag/3.5.
|
167
|
-
documentation_uri: https://docs.couchbase.com/sdk-api/couchbase-ruby-client-3.5.
|
164
|
+
source_code_uri: https://github.com/couchbase/couchbase-ruby-client/tree/3.5.2
|
165
|
+
changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases/tag/3.5.2
|
166
|
+
documentation_uri: https://docs.couchbase.com/sdk-api/couchbase-ruby-client-3.5.2/index.html
|
168
167
|
github_repo: ssh://github.com/couchbase/couchbase-ruby-client
|
169
168
|
rubygems_mfa_required: 'true'
|
170
169
|
post_install_message:
|
@@ -177,14 +176,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
176
|
requirements:
|
178
177
|
- - ">"
|
179
178
|
- !ruby/object:Gem::Version
|
180
|
-
version: '3.
|
179
|
+
version: '3.1'
|
181
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
181
|
requirements:
|
183
182
|
- - ">="
|
184
183
|
- !ruby/object:Gem::Version
|
185
184
|
version: '0'
|
186
185
|
requirements: []
|
187
|
-
rubygems_version: 3.
|
186
|
+
rubygems_version: 3.3.27
|
188
187
|
signing_key:
|
189
188
|
specification_version: 4
|
190
189
|
summary: SDK for Couchbase Server
|
Binary file
|