searchkick 4.4.4 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/searchkick.rb +14 -1
- data/lib/searchkick/index_options.rb +33 -2
- data/lib/searchkick/query.rb +2 -2
- data/lib/searchkick/results.rb +1 -1
- data/lib/searchkick/version.rb +1 -1
- 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: 62e2797b9ad2290378febadeaab675b745b0318cd86a8219cada4774b529e290
|
4
|
+
data.tar.gz: 8f0956287e802ce93a67940f6283f914b58b38aee2240f3ef101ae08e7428966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34a3bf2400766d7a2e95c3ba430a42c08dc1cfeb6c2d26b4d6d2a04828fd5ee296f3b121b076f00502f7c0c849ff27e1e622635a70885ef7f1336f0b4b8709de
|
7
|
+
data.tar.gz: 1c190e32fa87aa03a025a349dfc200ced4c28069c524acaa7b3c220628c58b9da2742ae4c924a87bc354f920a7486cae176d2bd7078a72a98568a068b20df290
|
data/CHANGELOG.md
CHANGED
data/lib/searchkick.rb
CHANGED
@@ -74,11 +74,24 @@ module Searchkick
|
|
74
74
|
(defined?(@search_timeout) && @search_timeout) || timeout
|
75
75
|
end
|
76
76
|
|
77
|
+
# private
|
78
|
+
def self.server_info
|
79
|
+
@server_info ||= client.info
|
80
|
+
end
|
81
|
+
|
77
82
|
def self.server_version
|
78
|
-
@server_version ||=
|
83
|
+
@server_version ||= server_info["version"]["number"]
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.opensearch?
|
87
|
+
unless defined?(@opensearch)
|
88
|
+
@opensearch = server_info["version"]["distribution"] == "opensearch"
|
89
|
+
end
|
90
|
+
@opensearch
|
79
91
|
end
|
80
92
|
|
81
93
|
def self.server_below?(version)
|
94
|
+
server_version = opensearch? ? "7.10.2" : self.server_version
|
82
95
|
Gem::Version.new(server_version.split("-")[0]) < Gem::Version.new(version.split("-")[0])
|
83
96
|
end
|
84
97
|
|
@@ -235,6 +235,27 @@ module Searchkick
|
|
235
235
|
type: "kuromoji"
|
236
236
|
}
|
237
237
|
)
|
238
|
+
when "japanese2"
|
239
|
+
analyzer = {
|
240
|
+
type: "custom",
|
241
|
+
tokenizer: "kuromoji_tokenizer",
|
242
|
+
filter: [
|
243
|
+
"kuromoji_baseform",
|
244
|
+
"kuromoji_part_of_speech",
|
245
|
+
"cjk_width",
|
246
|
+
"ja_stop",
|
247
|
+
"searchkick_stemmer",
|
248
|
+
"lowercase"
|
249
|
+
]
|
250
|
+
}
|
251
|
+
settings[:analysis][:analyzer].merge!(
|
252
|
+
default_analyzer => analyzer.deep_dup,
|
253
|
+
searchkick_search: analyzer.deep_dup,
|
254
|
+
searchkick_search2: analyzer.deep_dup
|
255
|
+
)
|
256
|
+
settings[:analysis][:filter][:searchkick_stemmer] = {
|
257
|
+
type: "kuromoji_stemmer"
|
258
|
+
}
|
238
259
|
when "korean"
|
239
260
|
settings[:analysis][:analyzer].merge!(
|
240
261
|
default_analyzer => {
|
@@ -512,8 +533,18 @@ module Searchkick
|
|
512
533
|
end
|
513
534
|
settings[:analysis][:filter][:searchkick_synonym_graph] = synonym_graph
|
514
535
|
|
515
|
-
[:
|
516
|
-
|
536
|
+
if options[:language] == "japanese2"
|
537
|
+
[:searchkick_search, :searchkick_search2].each do |analyzer|
|
538
|
+
settings[:analysis][:analyzer][analyzer][:filter].insert(4, "searchkick_synonym_graph")
|
539
|
+
end
|
540
|
+
else
|
541
|
+
[:searchkick_search2, :searchkick_word_search].each do |analyzer|
|
542
|
+
unless settings[:analysis][:analyzer][analyzer].key?(:filter)
|
543
|
+
raise Searchkick::Error, "Search synonyms are not supported yet for language"
|
544
|
+
end
|
545
|
+
|
546
|
+
settings[:analysis][:analyzer][analyzer][:filter].insert(2, "searchkick_synonym_graph")
|
547
|
+
end
|
517
548
|
end
|
518
549
|
end
|
519
550
|
end
|
data/lib/searchkick/query.rb
CHANGED
@@ -353,8 +353,8 @@ module Searchkick
|
|
353
353
|
shared_options[:cutoff_frequency] = 0.001 unless operator.to_s == "and" || field_misspellings == false || (!below73? && !track_total_hits?)
|
354
354
|
qs << shared_options.merge(analyzer: "searchkick_search")
|
355
355
|
|
356
|
-
# searchkick_search and searchkick_search2 are the same for
|
357
|
-
unless %w(japanese korean polish ukrainian vietnamese).include?(searchkick_options[:language])
|
356
|
+
# searchkick_search and searchkick_search2 are the same for some languages
|
357
|
+
unless %w(japanese japanese2 korean polish ukrainian vietnamese).include?(searchkick_options[:language])
|
358
358
|
qs << shared_options.merge(analyzer: "searchkick_search2")
|
359
359
|
end
|
360
360
|
exclude_analyzer = "searchkick_search2"
|
data/lib/searchkick/results.rb
CHANGED
@@ -231,7 +231,7 @@ module Searchkick
|
|
231
231
|
index_alias = index.split("_")[0..-2].join("_")
|
232
232
|
Array((options[:index_mapping] || {})[index_alias])
|
233
233
|
end
|
234
|
-
raise Searchkick::Error, "Unknown model for index: #{index}" unless models.any?
|
234
|
+
raise Searchkick::Error, "Unknown model for index: #{index}. Pass the `models` option to the search method." unless models.any?
|
235
235
|
index_models[index] = models
|
236
236
|
end
|
237
237
|
|
data/lib/searchkick/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: searchkick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|