xapian_db 1.3.9 → 1.3.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a219ad5e9648568bdf084f50f5639133fb493a5dd6ec44c59e2adb03102c4bdc
4
- data.tar.gz: 472fa6a0894c26c46991d61cd891202aa444f92b661b2f3172856e050e6f30d5
3
+ metadata.gz: d51dc4c64a7d47ea51d42af7509932b6b15be2c02ec6d0ccd27482b762f4754d
4
+ data.tar.gz: dd2d7382f5537370e73f40bdb7d49d4e96a8b8ae3bfbe911aa54cfc6cff39694
5
5
  SHA512:
6
- metadata.gz: 8f4084aed2f0fce0edc901f695d076d740a61b72ea8e2ccd9b7315af3b7b389478da74d176e2bebf019d8d7f57632595cdc9a436df875c9f5ad16541f49ae96f
7
- data.tar.gz: 3f7463fab1bfdec7ff5c47306243c6c48ed10abfb0fbda970246bbc08289431e14c625ef6b98b53013182ac2ac5c9b07565739ec801f1e3add5f8720cf7f661a
6
+ metadata.gz: abd8997703c4be61c239942432e208e34724e2132f8b7c1ebcf0a74544f03f0f45c665a2571ca97d3e9c6519511113736a124369a2a06fe9ecb67150e06aeba2
7
+ data.tar.gz: 995ac1009c8177051cb63dd3ac001d3e6e33e5788e0b6ef5d24f52be9de71180e8708af77b625c4e72ea1bdce46a9600567e4451840caf7a72615cd1df8b53db
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 1.3.11 (November 13th, 2023)
2
+
3
+ Changes:
4
+
5
+ - Update sidekiq version
6
+
7
+ ## 1.3.10 (March 2nd, 2023)
8
+
9
+ Fixes:
10
+
11
+ - Improved the code that reads the `xapian_db.yml` file to allow aliases in the yml file when using Ruby 3.1 or higher.
12
+
1
13
  ## 1.3.9 (October 26th, 2022)
2
14
 
3
15
  Fixes:
@@ -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
- def index(obj, commit=true, changed_attrs: [])
20
- Sidekiq::Client.enqueue worker_class, :index, :class => obj.class.name, :id => obj.id, :changed_attrs => changed_attrs
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, commit=true)
26
- Sidekiq::Client.enqueue worker_class, :delete_doc, :xapian_id => xapian_id
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, options = {})
32
- Sidekiq::Client.enqueue worker_class, :reindex_class, :class => klass.name
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
@@ -30,7 +30,11 @@ module XapianDb
30
30
  # Read the database configuration file if there is one
31
31
  config_file_path = "#{Rails.root}/config/xapian_db.yml"
32
32
  if File.exist?(config_file_path)
33
- db_config = YAML::load_file config_file_path
33
+ db_config = if YAML.respond_to?(:unsafe_load_file) # Psych 4.0 way
34
+ YAML.unsafe_load_file(config_file_path)
35
+ else
36
+ YAML.load_file(config_file_path)
37
+ end
34
38
  env_config = db_config[Rails.env]
35
39
  env_config ? configure_from(env_config) : configure_defaults
36
40
  else
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.9
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: 2022-10-26 00:00:00.000000000 Z
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: 2.13.0
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: 2.13.0
138
+ version: '7.1'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: xapian-ruby
141
141
  requirement: !ruby/object:Gem::Requirement