xapian_db 1.3.10 → 1.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/xapian_db/index_writers/sidekiq_worker.rb +3 -0
- data/lib/xapian_db/index_writers/sidekiq_writer.rb +16 -6
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d51dc4c64a7d47ea51d42af7509932b6b15be2c02ec6d0ccd27482b762f4754d
|
4
|
+
data.tar.gz: dd2d7382f5537370e73f40bdb7d49d4e96a8b8ae3bfbe911aa54cfc6cff39694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abd8997703c4be61c239942432e208e34724e2132f8b7c1ebcf0a74544f03f0f45c665a2571ca97d3e9c6519511113736a124369a2a06fe9ecb67150e06aeba2
|
7
|
+
data.tar.gz: 995ac1009c8177051cb63dd3ac001d3e6e33e5788e0b6ef5d24f52be9de71180e8708af77b625c4e72ea1bdce46a9600567e4451840caf7a72615cd1df8b53db
|
data/CHANGELOG.md
CHANGED
@@ -24,16 +24,19 @@ module XapianDb
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def index(options)
|
27
|
+
options = JSON.parse(options)
|
27
28
|
klass = constantize options['class']
|
28
29
|
obj = klass.respond_to?('get') ? klass.get(options['id']) : klass.find(options['id'])
|
29
30
|
DirectWriter.index obj, true, changed_attrs: options[:changed_attrs]
|
30
31
|
end
|
31
32
|
|
32
33
|
def delete_doc(options)
|
34
|
+
options = JSON.parse(options)
|
33
35
|
DirectWriter.delete_doc_with options['xapian_id']
|
34
36
|
end
|
35
37
|
|
36
38
|
def reindex_class(options)
|
39
|
+
options = JSON.parse(options)
|
37
40
|
klass = constantize options['class']
|
38
41
|
DirectWriter.reindex_class klass, :verbose => false
|
39
42
|
end
|
@@ -16,20 +16,30 @@ module XapianDb
|
|
16
16
|
|
17
17
|
# Update an object in the index
|
18
18
|
# @param [Object] obj An instance of a class with a blueprint configuration
|
19
|
-
|
20
|
-
|
19
|
+
|
20
|
+
def queue
|
21
|
+
XapianDb::Config.sidekiq_queue
|
22
|
+
end
|
23
|
+
|
24
|
+
def index(obj, _commit= true, changed_attrs: [])
|
25
|
+
Sidekiq::Client.enqueue_to(queue, worker_class, 'index',
|
26
|
+
{
|
27
|
+
class: obj.class.name,
|
28
|
+
id: obj.id,
|
29
|
+
changed_attrs: changed_attrs
|
30
|
+
}.to_json)
|
21
31
|
end
|
22
32
|
|
23
33
|
# Remove an object from the index
|
24
34
|
# @param [String] xapian_id The document id
|
25
|
-
def delete_doc_with(xapian_id,
|
26
|
-
Sidekiq::Client.
|
35
|
+
def delete_doc_with(xapian_id, _commit= true)
|
36
|
+
Sidekiq::Client.enqueue_to(queue, worker_class, 'delete_doc', { xapian_id: xapian_id }.to_json)
|
27
37
|
end
|
28
38
|
|
29
39
|
# Reindex all objects of a given class
|
30
40
|
# @param [Class] klass The class to reindex
|
31
|
-
def reindex_class(klass,
|
32
|
-
Sidekiq::Client.
|
41
|
+
def reindex_class(klass, _options = {})
|
42
|
+
Sidekiq::Client.enqueue_to(queue, worker_class, 'reindex_class', { class: klass.name }.to_json)
|
33
43
|
end
|
34
44
|
|
35
45
|
def worker_class
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xapian_db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gernot Kogler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: daemons
|
@@ -126,16 +126,16 @@ dependencies:
|
|
126
126
|
name: sidekiq
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '7.1'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: '7.1'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: xapian-ruby
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|