typesensual 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/lib/typesensual/collection.rb +2 -2
- data/lib/typesensual/version.rb +1 -1
- data/lib/typesensual.rb +5 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 986f20583fee0570d7497961e2bd92daed4ec5d7f745917a25dfa7ba5ae8cc85
|
4
|
+
data.tar.gz: 0a8540f08e668a5693b62ff382e64d3ad3b4df15bb2e30e020f17a8bfac52fab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6467e0484f9bfbbdafb6fe56ac42aab211ad76d3a80d96d5cf627c125a210bfc219e2fd7558a908cda43f15ae9633e745908d7f83491a2ed5b6f053331b566e
|
7
|
+
data.tar.gz: 4796045542838b3882d1ee47affb5cbd8922fb95e5f4768faa1501941190665bd9773d3343305935adc2471bc7160f82f11d87273a147715e2821d0528465d93
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
typesensual (0.
|
4
|
+
typesensual (0.4.0)
|
5
5
|
activesupport (>= 6.1.5)
|
6
6
|
paint (>= 2.0.0)
|
7
7
|
typesense (>= 0.13.0)
|
@@ -9,13 +9,13 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (7.0.7)
|
12
|
+
activesupport (7.0.7.2)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 1.6, < 2)
|
15
15
|
minitest (>= 5.1)
|
16
16
|
tzinfo (~> 2.0)
|
17
17
|
ast (2.4.2)
|
18
|
-
commonmarker (0.23.
|
18
|
+
commonmarker (0.23.10)
|
19
19
|
concurrent-ruby (1.2.2)
|
20
20
|
diff-lcs (1.5.0)
|
21
21
|
docile (1.4.0)
|
@@ -26,7 +26,7 @@ GEM
|
|
26
26
|
concurrent-ruby (~> 1.0)
|
27
27
|
json (2.6.3)
|
28
28
|
minitest (5.19.0)
|
29
|
-
oj (3.16.
|
29
|
+
oj (3.16.1)
|
30
30
|
paint (2.3.0)
|
31
31
|
parallel (1.23.0)
|
32
32
|
parser (3.2.2.1)
|
@@ -157,7 +157,7 @@ class Typesensual
|
|
157
157
|
# @param doc [Hash] the document to insert
|
158
158
|
# @return [Boolean] if the document was inserted successfully
|
159
159
|
def insert_one!(doc)
|
160
|
-
typesense_collection.documents.
|
160
|
+
typesense_collection.documents.upsert(doc)
|
161
161
|
end
|
162
162
|
|
163
163
|
# Insert many documents into typesense. Notably, the input can be an enumerable
|
@@ -168,7 +168,7 @@ class Typesensual
|
|
168
168
|
# @return [Array<Hash>] any failed insertions
|
169
169
|
def insert_many!(docs, batch_size: 100)
|
170
170
|
docs.lazy.each_slice(batch_size).with_object([]) do |slice, failures|
|
171
|
-
results = typesense_collection.documents.import(slice, return_id: true)
|
171
|
+
results = typesense_collection.documents.import(slice, return_id: true, action: 'upsert')
|
172
172
|
failures.push(*results.reject { |result| result['success'] })
|
173
173
|
end
|
174
174
|
end
|
data/lib/typesensual/version.rb
CHANGED
data/lib/typesensual.rb
CHANGED
@@ -19,14 +19,16 @@ require 'typesensual/railtie' if defined?(Rails)
|
|
19
19
|
|
20
20
|
class Typesensual
|
21
21
|
class << self
|
22
|
-
attr_accessor :config
|
23
|
-
|
24
22
|
def client
|
25
23
|
config&.client
|
26
24
|
end
|
27
25
|
|
28
26
|
def configure(&block)
|
29
|
-
|
27
|
+
@config = Typesensual::Config.new(&block)
|
28
|
+
end
|
29
|
+
|
30
|
+
def config
|
31
|
+
@config ||= Typesensual::Config.new
|
30
32
|
end
|
31
33
|
|
32
34
|
# Get the collections that match the alias name
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typesensual
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emma Lejeck
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|