searchkick 4.6.3 → 5.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,16 +2,20 @@ module Searchkick
2
2
  class BulkReindexJob < ActiveJob::Base
3
3
  queue_as { Searchkick.queue_name }
4
4
 
5
+ # TODO remove min_id and max_id in Searchkick 6
5
6
  def perform(class_name:, record_ids: nil, index_name: nil, method_name: nil, batch_id: nil, min_id: nil, max_id: nil)
6
- klass = class_name.constantize
7
- index = index_name ? Searchkick::Index.new(index_name, **klass.searchkick_options) : klass.searchkick_index
7
+ model = Searchkick.load_model(class_name)
8
+ index = model.searchkick_index(name: index_name)
9
+
10
+ # legacy
8
11
  record_ids ||= min_id..max_id
9
- index.import_scope(
10
- Searchkick.load_records(klass, record_ids),
11
- method_name: method_name,
12
- batch: true,
13
- batch_id: batch_id
14
- )
12
+
13
+ relation = Searchkick.scope(model)
14
+ relation = Searchkick.load_records(relation, record_ids)
15
+ relation = relation.search_import if relation.respond_to?(:search_import)
16
+
17
+ RecordIndexer.new(index).reindex(relation, mode: :inline, method_name: method_name, full: false)
18
+ RelationIndexer.new(index).batch_completed(batch_id) if batch_id
15
19
  end
16
20
  end
17
21
  end
@@ -0,0 +1,40 @@
1
+ # based on https://gist.github.com/mnutt/566725
2
+ module Searchkick
3
+ module ControllerRuntime
4
+ extend ActiveSupport::Concern
5
+
6
+ protected
7
+
8
+ attr_internal :searchkick_runtime
9
+
10
+ def process_action(action, *args)
11
+ # We also need to reset the runtime before each action
12
+ # because of queries in middleware or in cases we are streaming
13
+ # and it won't be cleaned up by the method below.
14
+ Searchkick::LogSubscriber.reset_runtime
15
+ super
16
+ end
17
+
18
+ def cleanup_view_runtime
19
+ searchkick_rt_before_render = Searchkick::LogSubscriber.reset_runtime
20
+ runtime = super
21
+ searchkick_rt_after_render = Searchkick::LogSubscriber.reset_runtime
22
+ self.searchkick_runtime = searchkick_rt_before_render + searchkick_rt_after_render
23
+ runtime - searchkick_rt_after_render
24
+ end
25
+
26
+ def append_info_to_payload(payload)
27
+ super
28
+ payload[:searchkick_runtime] = (searchkick_runtime || 0) + Searchkick::LogSubscriber.reset_runtime
29
+ end
30
+
31
+ module ClassMethods
32
+ def log_process_action(payload)
33
+ messages = super
34
+ runtime = payload[:searchkick_runtime]
35
+ messages << ("Searchkick: %.1fms" % runtime.to_f) if runtime.to_f > 0
36
+ messages
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,5 +1,3 @@
1
- require "searchkick/index_options"
2
-
3
1
  module Searchkick
4
2
  class Index
5
3
  attr_reader :name, :options
@@ -40,12 +38,15 @@ module Searchkick
40
38
  client.indices.exists_alias name: name
41
39
  end
42
40
 
41
+ # call to_h for consistent results between elasticsearch gem 7 and 8
42
+ # could do for all API calls, but just do for ones where return value is focus for now
43
43
  def mapping
44
- client.indices.get_mapping index: name
44
+ client.indices.get_mapping(index: name).to_h
45
45
  end
46
46
 
47
+ # call to_h for consistent results between elasticsearch gem 7 and 8
47
48
  def settings
48
- client.indices.get_settings index: name
49
+ client.indices.get_settings(index: name).to_h
49
50
  end
50
51
 
51
52
  def refresh_interval
@@ -66,16 +67,17 @@ module Searchkick
66
67
  index: name,
67
68
  body: {
68
69
  query: {match_all: {}},
69
- size: 0
70
+ size: 0,
71
+ track_total_hits: true
70
72
  }
71
73
  )
72
74
 
73
- Searchkick::Results.new(nil, response).total_count
75
+ Results.new(nil, response).total_count
74
76
  end
75
77
 
76
78
  def promote(new_name, update_refresh_interval: false)
77
79
  if update_refresh_interval
78
- new_index = Searchkick::Index.new(new_name, @options)
80
+ new_index = Index.new(new_name, @options)
79
81
  settings = options[:settings] || {}
80
82
  refresh_interval = (settings[:index] && settings[:index][:refresh_interval]) || "1s"
81
83
  new_index.update_settings(index: {refresh_interval: refresh_interval})
@@ -97,7 +99,7 @@ module Searchkick
97
99
  record_data = RecordData.new(self, record).record_data
98
100
 
99
101
  # remove underscore
100
- get_options = Hash[record_data.map { |k, v| [k.to_s.sub(/\A_/, "").to_sym, v] }]
102
+ get_options = record_data.to_h { |k, v| [k.to_s.sub(/\A_/, "").to_sym, v] }
101
103
 
102
104
  client.get(get_options)["_source"]
103
105
  end
@@ -122,37 +124,52 @@ module Searchkick
122
124
  def clean_indices
123
125
  indices = all_indices(unaliased: true)
124
126
  indices.each do |index|
125
- Searchkick::Index.new(index).delete
127
+ Index.new(index).delete
126
128
  end
127
129
  indices
128
130
  end
129
131
 
130
- # record based
131
- # use helpers for notifications
132
-
133
132
  def store(record)
134
- bulk_indexer.bulk_index([record])
133
+ notify(record, "Store") do
134
+ queue_index([record])
135
+ end
135
136
  end
136
137
 
137
138
  def remove(record)
138
- bulk_indexer.bulk_delete([record])
139
+ notify(record, "Remove") do
140
+ queue_delete([record])
141
+ end
139
142
  end
140
143
 
141
144
  def update_record(record, method_name)
142
- bulk_indexer.bulk_update([record], method_name)
145
+ notify(record, "Update") do
146
+ queue_update([record], method_name)
147
+ end
143
148
  end
144
149
 
145
150
  def bulk_delete(records)
146
- bulk_indexer.bulk_delete(records)
151
+ return if records.empty?
152
+
153
+ notify_bulk(records, "Delete") do
154
+ queue_delete(records)
155
+ end
147
156
  end
148
157
 
149
158
  def bulk_index(records)
150
- bulk_indexer.bulk_index(records)
159
+ return if records.empty?
160
+
161
+ notify_bulk(records, "Import") do
162
+ queue_index(records)
163
+ end
151
164
  end
152
165
  alias_method :import, :bulk_index
153
166
 
154
167
  def bulk_update(records, method_name)
155
- bulk_indexer.bulk_update(records, method_name)
168
+ return if records.empty?
169
+
170
+ notify_bulk(records, "Update") do
171
+ queue_update(records, method_name)
172
+ end
156
173
  end
157
174
 
158
175
  def search_id(record)
@@ -163,20 +180,12 @@ module Searchkick
163
180
  RecordData.new(self, record).document_type
164
181
  end
165
182
 
166
- # TODO use like: [{_index: ..., _id: ...}] in Searchkick 5
167
183
  def similar_record(record, **options)
168
- like_text = retrieve(record).to_hash
169
- .keep_if { |k, _| !options[:fields] || options[:fields].map(&:to_s).include?(k) }
170
- .values.compact.join(" ")
171
-
172
- options[:where] ||= {}
173
- options[:where][:_id] ||= {}
174
- options[:where][:_id][:not] = Array(options[:where][:_id][:not]) + [record.id.to_s]
175
184
  options[:per_page] ||= 10
176
- options[:similar] = true
185
+ options[:similar] = [RecordData.new(self, record).record_data]
186
+ options[:models] ||= [record.class] unless options.key?(:model)
177
187
 
178
- # TODO use index class instead of record class
179
- Searchkick.search(like_text, model: record.class, **options)
188
+ Searchkick.search("*", **options)
180
189
  end
181
190
 
182
191
  def reload_synonyms
@@ -186,8 +195,9 @@ module Searchkick
186
195
  raise Error, "Requires Elasticsearch 7.3+" if Searchkick.server_below?("7.3.0")
187
196
  begin
188
197
  client.transport.perform_request("GET", "#{CGI.escape(name)}/_reload_search_analyzers")
189
- rescue Elasticsearch::Transport::Transport::Errors::MethodNotAllowed
190
- raise Error, "Requires non-OSS version of Elasticsearch"
198
+ rescue => e
199
+ raise Error, "Requires non-OSS version of Elasticsearch" if Searchkick.not_allowed_error?(e)
200
+ raise e
191
201
  end
192
202
  end
193
203
  end
@@ -195,54 +205,72 @@ module Searchkick
195
205
  # queue
196
206
 
197
207
  def reindex_queue
198
- Searchkick::ReindexQueue.new(name)
208
+ ReindexQueue.new(name)
199
209
  end
200
210
 
201
211
  # reindex
202
212
 
203
- def reindex(relation, method_name, scoped:, full: false, scope: nil, **options)
213
+ # note: this is designed to be used internally
214
+ # so it does not check object matches index class
215
+ def reindex(object, method_name: nil, full: false, **options)
216
+ if object.is_a?(Array)
217
+ # note: purposefully skip full
218
+ return reindex_records(object, method_name: method_name, **options)
219
+ end
220
+
221
+ if !object.respond_to?(:searchkick_klass)
222
+ raise Error, "Cannot reindex object"
223
+ end
224
+
225
+ scoped = Searchkick.relation?(object)
226
+ # call searchkick_klass for inheritance
227
+ relation = scoped ? object.all : Searchkick.scope(object.searchkick_klass).all
228
+
204
229
  refresh = options.fetch(:refresh, !scoped)
205
230
  options.delete(:refresh)
206
231
 
207
- if method_name
208
- # TODO throw ArgumentError
209
- Searchkick.warn("unsupported keywords: #{options.keys.map(&:inspect).join(", ")}") if options.any?
232
+ if method_name || (scoped && !full)
233
+ mode = options.delete(:mode) || :inline
234
+ raise ArgumentError, "unsupported keywords: #{options.keys.map(&:inspect).join(", ")}" if options.any?
210
235
 
211
- # update
212
- import_scope(relation, method_name: method_name, scope: scope)
213
- self.refresh if refresh
214
- true
215
- elsif scoped && !full
216
- # TODO throw ArgumentError
217
- Searchkick.warn("unsupported keywords: #{options.keys.map(&:inspect).join(", ")}") if options.any?
218
-
219
- # reindex association
220
- import_scope(relation, scope: scope)
236
+ # import only
237
+ import_scope(relation, method_name: method_name, mode: mode)
221
238
  self.refresh if refresh
222
239
  true
223
240
  else
224
- # full reindex
225
- reindex_scope(relation, scope: scope, **options)
241
+ async = options.delete(:async)
242
+ if async
243
+ if async.is_a?(Hash) && async[:wait]
244
+ # TODO warn in 5.1
245
+ # Searchkick.warn "async option is deprecated - use mode: :async, wait: true instead"
246
+ options[:wait] = true unless options.key?(:wait)
247
+ else
248
+ # TODO warn in 5.1
249
+ # Searchkick.warn "async option is deprecated - use mode: :async instead"
250
+ end
251
+ options[:mode] ||= :async
252
+ end
253
+
254
+ full_reindex(relation, **options)
226
255
  end
227
256
  end
228
257
 
229
258
  def create_index(index_options: nil)
230
259
  index_options ||= self.index_options
231
- index = Searchkick::Index.new("#{name}_#{Time.now.strftime('%Y%m%d%H%M%S%L')}", @options)
260
+ index = Index.new("#{name}_#{Time.now.strftime('%Y%m%d%H%M%S%L')}", @options)
232
261
  index.create(index_options)
233
262
  index
234
263
  end
235
264
 
236
265
  def import_scope(relation, **options)
237
- bulk_indexer.import_scope(relation, **options)
266
+ relation_indexer.reindex(relation, **options)
238
267
  end
239
268
 
240
269
  def batches_left
241
- bulk_indexer.batches_left
270
+ relation_indexer.batches_left
242
271
  end
243
272
 
244
- # other
245
-
273
+ # private
246
274
  def klass_document_type(klass, ignore_type = false)
247
275
  @klass_document_type[[klass, ignore_type]] ||= begin
248
276
  if !ignore_type && klass.searchkick_klass.searchkick_options[:_type]
@@ -255,7 +283,7 @@ module Searchkick
255
283
  end
256
284
  end
257
285
 
258
- # should not be public
286
+ # private
259
287
  def conversions_fields
260
288
  @conversions_fields ||= begin
261
289
  conversions = Array(options[:conversions])
@@ -263,10 +291,12 @@ module Searchkick
263
291
  end
264
292
  end
265
293
 
294
+ # private
266
295
  def suggest_fields
267
296
  @suggest_fields ||= Array(options[:suggest]).map(&:to_s)
268
297
  end
269
298
 
299
+ # private
270
300
  def locations_fields
271
301
  @locations_fields ||= begin
272
302
  locations = Array(options[:locations])
@@ -285,8 +315,20 @@ module Searchkick
285
315
  Searchkick.client
286
316
  end
287
317
 
288
- def bulk_indexer
289
- @bulk_indexer ||= BulkIndexer.new(self)
318
+ def queue_index(records)
319
+ Searchkick.indexer.queue(records.map { |r| RecordData.new(self, r).index_data })
320
+ end
321
+
322
+ def queue_delete(records)
323
+ Searchkick.indexer.queue(records.reject { |r| r.id.blank? }.map { |r| RecordData.new(self, r).delete_data })
324
+ end
325
+
326
+ def queue_update(records, method_name)
327
+ Searchkick.indexer.queue(records.map { |r| RecordData.new(self, r).update_data(method_name) })
328
+ end
329
+
330
+ def relation_indexer
331
+ @relation_indexer ||= RelationIndexer.new(self)
290
332
  end
291
333
 
292
334
  def index_settings
@@ -297,13 +339,24 @@ module Searchkick
297
339
  index.import_scope(relation, **import_options)
298
340
  end
299
341
 
342
+ def reindex_records(object, mode: nil, refresh: false, **options)
343
+ mode ||= Searchkick.callbacks_value || @options[:callbacks] || :inline
344
+ mode = :inline if mode == :bulk
345
+
346
+ result = RecordIndexer.new(self).reindex(object, mode: mode, full: false, **options)
347
+ self.refresh if refresh
348
+ result
349
+ end
350
+
300
351
  # https://gist.github.com/jarosan/3124884
301
352
  # http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/
302
- def reindex_scope(relation, import: true, resume: false, retain: false, async: false, refresh_interval: nil, scope: nil)
353
+ def full_reindex(relation, import: true, resume: false, retain: false, mode: nil, refresh_interval: nil, scope: nil, wait: nil)
354
+ raise ArgumentError, "wait only available in :async mode" if !wait.nil? && mode != :async
355
+
303
356
  if resume
304
357
  index_name = all_indices.sort.last
305
- raise Searchkick::Error, "No index to resume" unless index_name
306
- index = Searchkick::Index.new(index_name, @options)
358
+ raise Error, "No index to resume" unless index_name
359
+ index = Index.new(index_name, @options)
307
360
  else
308
361
  clean_indices unless retain
309
362
 
@@ -313,9 +366,9 @@ module Searchkick
313
366
  end
314
367
 
315
368
  import_options = {
316
- resume: resume,
317
- async: async,
369
+ mode: (mode || :inline),
318
370
  full: true,
371
+ resume: resume,
319
372
  scope: scope
320
373
  }
321
374
 
@@ -327,7 +380,7 @@ module Searchkick
327
380
  import_before_promotion(index, relation, **import_options) if import
328
381
 
329
382
  # get existing indices to remove
330
- unless async
383
+ unless mode == :async
331
384
  check_uuid(uuid, index.uuid)
332
385
  promote(index.name, update_refresh_interval: !refresh_interval.nil?)
333
386
  clean_indices unless retain
@@ -340,8 +393,8 @@ module Searchkick
340
393
  index.import_scope(relation, **import_options) if import
341
394
  end
342
395
 
343
- if async
344
- if async.is_a?(Hash) && async[:wait]
396
+ if mode == :async
397
+ if wait
345
398
  puts "Created index: #{index.name}"
346
399
  puts "Jobs queued. Waiting..."
347
400
  loop do
@@ -366,8 +419,8 @@ module Searchkick
366
419
  true
367
420
  end
368
421
  rescue => e
369
- if Searchkick.transport_error?(e) && e.message.include?("No handler for type [text]")
370
- raise UnsupportedVersionError, "This version of Searchkick requires Elasticsearch 6 or greater"
422
+ if Searchkick.transport_error?(e) && (e.message.include?("No handler for type [text]") || e.message.include?("class java.util.ArrayList cannot be cast to class java.util.Map"))
423
+ raise UnsupportedVersionError
371
424
  end
372
425
 
373
426
  raise e
@@ -379,7 +432,36 @@ module Searchkick
379
432
  # https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#index-creation
380
433
  def check_uuid(old_uuid, new_uuid)
381
434
  if old_uuid != new_uuid
382
- raise Searchkick::Error, "Safety check failed - only run one Model.reindex per model at a time"
435
+ raise Error, "Safety check failed - only run one Model.reindex per model at a time"
436
+ end
437
+ end
438
+
439
+ def notify(record, name)
440
+ if Searchkick.callbacks_value == :bulk
441
+ yield
442
+ else
443
+ name = "#{record.class.searchkick_klass.name} #{name}" if record && record.class.searchkick_klass
444
+ event = {
445
+ name: name,
446
+ id: search_id(record)
447
+ }
448
+ ActiveSupport::Notifications.instrument("request.searchkick", event) do
449
+ yield
450
+ end
451
+ end
452
+ end
453
+
454
+ def notify_bulk(records, name)
455
+ if Searchkick.callbacks_value == :bulk
456
+ yield
457
+ else
458
+ event = {
459
+ name: "#{records.first.class.searchkick_klass.name} #{name}",
460
+ count: records.size
461
+ }
462
+ ActiveSupport::Notifications.instrument("request.searchkick", event) do
463
+ yield
464
+ end
383
465
  end
384
466
  end
385
467
  end
@@ -0,0 +1,30 @@
1
+ module Searchkick
2
+ class IndexCache
3
+ def initialize(max_size: 20)
4
+ @data = {}
5
+ @mutex = Mutex.new
6
+ @max_size = max_size
7
+ end
8
+
9
+ # probably a better pattern for this
10
+ # but keep it simple
11
+ def fetch(name)
12
+ # thread-safe in MRI without mutex
13
+ # due to how context switching works
14
+ @mutex.synchronize do
15
+ if @data.key?(name)
16
+ @data[name]
17
+ else
18
+ @data.clear if @data.size >= @max_size
19
+ @data[name] = yield
20
+ end
21
+ end
22
+ end
23
+
24
+ def clear
25
+ @mutex.synchronize do
26
+ @data.clear
27
+ end
28
+ end
29
+ end
30
+ end
@@ -7,21 +7,19 @@ module Searchkick
7
7
  end
8
8
 
9
9
  def index_options
10
- custom_mapping = options[:mappings] || {}
11
- if below70? && custom_mapping.keys.map(&:to_sym).include?(:properties)
12
- # add type
13
- custom_mapping = {index_type => custom_mapping}
14
- end
10
+ # mortal symbols are garbage collected in Ruby 2.2+
11
+ custom_settings = (options[:settings] || {}).deep_symbolize_keys
12
+ custom_mappings = (options[:mappings] || {}).deep_symbolize_keys
15
13
 
16
14
  if options[:mappings] && !options[:merge_mappings]
17
- settings = options[:settings] || {}
18
- mappings = custom_mapping
15
+ settings = custom_settings
16
+ mappings = custom_mappings
19
17
  else
20
- settings = generate_settings
21
- mappings = generate_mappings.symbolize_keys.deep_merge(custom_mapping.symbolize_keys)
18
+ settings = generate_settings.deep_symbolize_keys.deep_merge(custom_settings)
19
+ mappings = generate_mappings.deep_symbolize_keys.deep_merge(custom_mappings)
22
20
  end
23
21
 
24
- set_deep_paging(settings) if options[:deep_paging]
22
+ set_deep_paging(settings) if options[:deep_paging] || options[:max_result_window]
25
23
 
26
24
  {
27
25
  settings: settings,
@@ -162,17 +160,14 @@ module Searchkick
162
160
  settings[:number_of_replicas] = 0
163
161
  end
164
162
 
165
- # TODO remove in Searchkick 5 (classic no longer supported)
166
163
  if options[:similarity]
167
164
  settings[:similarity] = {default: {type: options[:similarity]}}
168
165
  end
169
166
 
170
- unless below62?
171
- settings[:index] = {
172
- max_ngram_diff: 49,
173
- max_shingle_diff: 4
174
- }
175
- end
167
+ settings[:index] = {
168
+ max_ngram_diff: 49,
169
+ max_shingle_diff: 4
170
+ }
176
171
 
177
172
  if options[:case_sensitive]
178
173
  settings[:analysis][:analyzer].each do |_, analyzer|
@@ -180,13 +175,8 @@ module Searchkick
180
175
  end
181
176
  end
182
177
 
183
- # TODO do this last in Searchkick 5
184
- settings = settings.symbolize_keys.deep_merge((options[:settings] || {}).symbolize_keys)
185
-
186
178
  add_synonyms(settings)
187
179
  add_search_synonyms(settings)
188
- # TODO remove in Searchkick 5
189
- add_wordnet(settings) if options[:wordnet]
190
180
 
191
181
  if options[:special_characters] == false
192
182
  settings[:analysis][:analyzer].each_value do |analyzer_settings|
@@ -223,19 +213,7 @@ module Searchkick
223
213
  type: "smartcn"
224
214
  }
225
215
  )
226
- when "japanese"
227
- settings[:analysis][:analyzer].merge!(
228
- default_analyzer => {
229
- type: "kuromoji"
230
- },
231
- searchkick_search: {
232
- type: "kuromoji"
233
- },
234
- searchkick_search2: {
235
- type: "kuromoji"
236
- }
237
- )
238
- when "japanese2"
216
+ when "japanese", "japanese2"
239
217
  analyzer = {
240
218
  type: "custom",
241
219
  tokenizer: "kuromoji_tokenizer",
@@ -379,16 +357,15 @@ module Searchkick
379
357
  }
380
358
  end
381
359
 
382
- mapping_options = Hash[
360
+ mapping_options =
383
361
  [:suggest, :word, :text_start, :text_middle, :text_end, :word_start, :word_middle, :word_end, :highlight, :searchable, :filterable]
384
- .map { |type| [type, (options[type] || []).map(&:to_s)] }
385
- ]
362
+ .to_h { |type| [type, (options[type] || []).map(&:to_s)] }
386
363
 
387
364
  word = options[:word] != false && (!options[:match] || options[:match] == :word)
388
365
 
389
366
  mapping_options[:searchable].delete("_all")
390
367
 
391
- analyzed_field_options = {type: default_type, index: true, analyzer: default_analyzer}
368
+ analyzed_field_options = {type: default_type, index: true, analyzer: default_analyzer.to_s}
392
369
 
393
370
  mapping_options.values.flatten.uniq.each do |field|
394
371
  fields = {}
@@ -481,10 +458,6 @@ module Searchkick
481
458
  ]
482
459
  }
483
460
 
484
- if below70?
485
- mappings = {index_type => mappings}
486
- end
487
-
488
461
  mappings
489
462
  end
490
463
 
@@ -533,14 +506,14 @@ module Searchkick
533
506
  end
534
507
  settings[:analysis][:filter][:searchkick_synonym_graph] = synonym_graph
535
508
 
536
- if options[:language] == "japanese2"
509
+ if ["japanese", "japanese2"].include?(options[:language])
537
510
  [:searchkick_search, :searchkick_search2].each do |analyzer|
538
511
  settings[:analysis][:analyzer][analyzer][:filter].insert(4, "searchkick_synonym_graph")
539
512
  end
540
513
  else
541
514
  [:searchkick_search2, :searchkick_word_search].each do |analyzer|
542
515
  unless settings[:analysis][:analyzer][analyzer].key?(:filter)
543
- raise Searchkick::Error, "Search synonyms are not supported yet for language"
516
+ raise Error, "Search synonyms are not supported yet for language"
544
517
  end
545
518
 
546
519
  settings[:analysis][:analyzer][analyzer][:filter].insert(2, "searchkick_synonym_graph")
@@ -549,25 +522,10 @@ module Searchkick
549
522
  end
550
523
  end
551
524
 
552
- def add_wordnet(settings)
553
- settings[:analysis][:filter][:searchkick_wordnet] = {
554
- type: "synonym",
555
- format: "wordnet",
556
- synonyms_path: Searchkick.wordnet_path
557
- }
558
-
559
- settings[:analysis][:analyzer][default_analyzer][:filter].insert(4, "searchkick_wordnet")
560
- settings[:analysis][:analyzer][default_analyzer][:filter] << "searchkick_wordnet"
561
-
562
- %w(word_start word_middle word_end).each do |type|
563
- settings[:analysis][:analyzer]["searchkick_#{type}_index".to_sym][:filter].insert(2, "searchkick_wordnet")
564
- end
565
- end
566
-
567
525
  def set_deep_paging(settings)
568
526
  if !settings.dig(:index, :max_result_window) && !settings[:"index.max_result_window"]
569
527
  settings[:index] ||= {}
570
- settings[:index][:max_result_window] = 1_000_000_000
528
+ settings[:index][:max_result_window] = options[:max_result_window] || 1_000_000_000
571
529
  end
572
530
  end
573
531
 
@@ -587,14 +545,6 @@ module Searchkick
587
545
  :searchkick_index
588
546
  end
589
547
 
590
- def below62?
591
- Searchkick.server_below?("6.2.0")
592
- end
593
-
594
- def below70?
595
- Searchkick.server_below?("7.0.0")
596
- end
597
-
598
548
  def below73?
599
549
  Searchkick.server_below?("7.3.0")
600
550
  end