xapian_db 1.3.11 → 1.3.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d51dc4c64a7d47ea51d42af7509932b6b15be2c02ec6d0ccd27482b762f4754d
4
- data.tar.gz: dd2d7382f5537370e73f40bdb7d49d4e96a8b8ae3bfbe911aa54cfc6cff39694
3
+ metadata.gz: a29f75d11adde6b1e29a279ca708947892348e8cec46d5713a830c71c02b5885
4
+ data.tar.gz: 4d466f487f8c9df855d6a3ba49a28201e7aad91ff9efec6c8aa7a827dd25e616
5
5
  SHA512:
6
- metadata.gz: abd8997703c4be61c239942432e208e34724e2132f8b7c1ebcf0a74544f03f0f45c665a2571ca97d3e9c6519511113736a124369a2a06fe9ecb67150e06aeba2
7
- data.tar.gz: 995ac1009c8177051cb63dd3ac001d3e6e33e5788e0b6ef5d24f52be9de71180e8708af77b625c4e72ea1bdce46a9600567e4451840caf7a72615cd1df8b53db
6
+ metadata.gz: a3ef99e32b11ea43b1d5147036ad9e52a9fa513a4298d3800f24534837d4cf8c3e7a950fb6cd90f7abd81e3837901926fbf9ec0d2a66afdcf5b1ba11cd29a143
7
+ data.tar.gz: 30afda34bf9dfbcbf8d8f3838c8dd6971cacc19f8846ee5ec22a4fcdb70bb275e374e7e6f3c847e138cb30cc269b1b53289ba4737bc514b679305133415d230c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 1.3.13 (August 26th, 2024)
2
+
3
+ Changes:
4
+
5
+ - make sidekiq_retry configurable for Xapian
6
+
7
+ ## 1.3.12 (August 23th, 2024)
8
+
9
+ Changes:
10
+
11
+ - Add set_max_expansion option
12
+
1
13
  ## 1.3.11 (November 13th, 2023)
2
14
 
3
15
  Changes:
data/README.rdoc CHANGED
@@ -536,8 +536,11 @@ Install and start redis as described on the {resque github page}[https://github.
536
536
  database: db/xapian_db/production
537
537
  writer: sidekiq
538
538
  sidekiq_queue: my_queue
539
+ set_max_expansion: 100
540
+ sidekiq_retry: false
539
541
 
540
542
  If you don't specify a queue name XapianDb will use 'xapian_db' by default.
543
+ Additionally, if you don't provide a 'sidekiq_retry' option, it will default to 'false'.
541
544
 
542
545
  === 4. Start sidekiq
543
546
 
@@ -57,6 +57,14 @@ module XapianDb
57
57
  @config.instance_variable_get("@_term_min_length") || 1
58
58
  end
59
59
 
60
+ def set_max_expansion
61
+ @config.instance_variable_get("@_set_max_expansion")
62
+ end
63
+
64
+ def sidekiq_retry
65
+ @config.instance_variable_get("@_sidekiq_retry") || false
66
+ end
67
+
60
68
  def term_splitter_count
61
69
  @config.instance_variable_get("@_term_splitter_count") || 0
62
70
  end
@@ -74,8 +82,9 @@ module XapianDb
74
82
  # DSL methods
75
83
  # ---------------------------------------------------------------------------------
76
84
 
77
- attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_resque_queue, :_sidekiq_queue,
78
- :_stemmer, :_stopper, :_term_min_length, :_term_splitter_count, :_enabled_query_flags
85
+ attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_resque_queue, :_sidekiq_queue,
86
+ :_stemmer, :_stopper, :_term_min_length, :_term_splitter_count, :_enabled_query_flags,
87
+ :_set_max_expansion, :_sidekiq_retry
79
88
 
80
89
  # Set the global database to use
81
90
  # @param [String] path The path to the database. Either apply a file sytem path or :memory
@@ -149,6 +158,18 @@ module XapianDb
149
158
  @_sidekiq_queue = name
150
159
  end
151
160
 
161
+ # Set the value for the max_expansion setting.
162
+ # @param [Integer] value The value to set for the set_max_expansion setting.
163
+ def set_max_expansion(value)
164
+ @_set_max_expansion = value
165
+ end
166
+
167
+ # Set the value for the Sidekiq retry setting.
168
+ # @param [Boolean, Numeric] value The value to set for the Sidekiq retry setting.
169
+ def sidekiq_retry(value)
170
+ @_sidekiq_retry = value
171
+ end
172
+
152
173
  # Set the language.
153
174
  # @param [Symbol] lang The language; apply the two letter ISO639 code for the language
154
175
  # @example
@@ -40,6 +40,14 @@ module XapianDb
40
40
  klass = constantize options['class']
41
41
  DirectWriter.reindex_class klass, :verbose => false
42
42
  end
43
+
44
+ def set_max_expansion
45
+ XapianDb::Config.set_max_expansion
46
+ end
47
+
48
+ def sidekiq_retry
49
+ XapianDb::Config.sidekiq_retry
50
+ end
43
51
  end
44
52
  end
45
53
  end
@@ -10,36 +10,48 @@ module XapianDb
10
10
 
11
11
  SidekiqWorker.class_eval do
12
12
  include Sidekiq::Worker
13
+
14
+ sidekiq_options set_max_expansion: set_max_expansion
13
15
  end
14
16
 
15
17
  class << self
16
-
17
- # Update an object in the index
18
- # @param [Object] obj An instance of a class with a blueprint configuration
19
-
20
18
  def queue
21
19
  XapianDb::Config.sidekiq_queue
22
20
  end
23
21
 
22
+ # Update an object in the index
23
+ # @param [Object] obj An instance of a class with a blueprint configuration
24
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)
25
+ Sidekiq::Client.push('queue' => queue,
26
+ 'class' => worker_class,
27
+ 'args' => ['index', { class: obj.class.name, id: obj.id, changed_attrs: changed_attrs }.to_json],
28
+ 'retry' => sidekiq_retry)
31
29
  end
32
30
 
33
31
  # Remove an object from the index
34
32
  # @param [String] xapian_id The document id
35
33
  def delete_doc_with(xapian_id, _commit= true)
36
- Sidekiq::Client.enqueue_to(queue, worker_class, 'delete_doc', { xapian_id: xapian_id }.to_json)
34
+ Sidekiq::Client.push('queue' => queue,
35
+ 'class' => worker_class,
36
+ 'args' => ['delete_doc', { xapian_id: xapian_id }.to_json],
37
+ 'retry' => sidekiq_retry)
37
38
  end
38
39
 
39
40
  # Reindex all objects of a given class
40
41
  # @param [Class] klass The class to reindex
41
42
  def reindex_class(klass, _options = {})
42
- Sidekiq::Client.enqueue_to(queue, worker_class, 'reindex_class', { class: klass.name }.to_json)
43
+ Sidekiq::Client.push('queue' => queue,
44
+ 'class' => worker_class,
45
+ 'args' => ['reindex_class', { class: klass.name }.to_json],
46
+ 'retry' => sidekiq_retry)
47
+ end
48
+
49
+ def set_max_expansion
50
+ XapianDb::Config.set_max_expansion
51
+ end
52
+
53
+ def sidekiq_retry
54
+ XapianDb::Config.sidekiq_retry
43
55
  end
44
56
 
45
57
  def worker_class
@@ -32,6 +32,8 @@ module XapianDb
32
32
  parser.stemming_strategy = Xapian::QueryParser::STEM_SOME
33
33
  parser.stopper = XapianDb::Config.stopper
34
34
  end
35
+ max_expansion = XapianDb::Config.set_max_expansion
36
+ parser.set_max_expansion(max_expansion, Xapian::Query::WILDCARD_LIMIT_MOST_FREQUENT) if max_expansion
35
37
 
36
38
  # Add the searchable prefixes to allow searches by field
37
39
  # (like "name:Kogler")
@@ -58,6 +58,8 @@ module XapianDb
58
58
  config.language @language.try(:to_sym)
59
59
  config.term_min_length @term_min_length
60
60
  config.term_splitter_count @term_splitter_count
61
+ config.set_max_expansion @set_max_expansion
62
+ config.sidekiq_retry @sidekiq_retry
61
63
  @enabled_query_flags.each { |flag| config.enable_query_flag flag }
62
64
  @disabled_query_flags.each { |flag| config.disable_query_flag flag }
63
65
  end
@@ -85,6 +87,8 @@ module XapianDb
85
87
  @term_min_length = env_config["term_min_length"]
86
88
  @enable_phrase_search = env_config["enable_phrase_search"] == true
87
89
  @term_splitter_count = env_config["term_splitter_count"] || 0
90
+ @set_max_expansion = env_config["set_max_expansion"]
91
+ @sidekiq_retry = env_config["sidekiq_retry"]
88
92
 
89
93
  if env_config["enabled_query_flags"]
90
94
  @enabled_query_flags = []
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.11
4
+ version: 1.3.13
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-13 00:00:00.000000000 Z
11
+ date: 2024-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons