searchkick 4.4.2 → 4.4.3
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +13 -5
- data/lib/searchkick/index.rb +1 -1
- data/lib/searchkick/index_options.rb +13 -0
- data/lib/searchkick/model.rb +1 -1
- data/lib/searchkick/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7aee5e029431f1fd4579a1d516685ba2920de38baf458ecd703e5500b9c0cee
|
4
|
+
data.tar.gz: 6dde3b60089496b874e43870c1506c54e25d0f5ca857fb96f1aa29880a110260
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a242a1c7190e5545bb0c9ffb902d711c360637da770c4f35a560abb34889f3cd8bec4e6efc989aad18c8c9c7aef00e46a7d70a3631e66f44322894f9540ce84
|
7
|
+
data.tar.gz: bed6eb9390d71a22791bb7a294c5e2adc2f26dec43c946f9fa5f3c850e0dc44d428e9ee8eda828c218b559484f35c8fe12b9503eaae0a643f0d72ee8e004a88e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -176,7 +176,7 @@ Get the full response from Elasticsearch
|
|
176
176
|
results.response
|
177
177
|
```
|
178
178
|
|
179
|
-
**Note:** By default, Elasticsearch [limits paging](#deep-paging
|
179
|
+
**Note:** By default, Elasticsearch [limits paging](#deep-paging) to the first 10,000 results for performance. With Elasticsearch 7, this applies to the total count as well.
|
180
180
|
|
181
181
|
### Boosting
|
182
182
|
|
@@ -209,7 +209,7 @@ boost_by_recency: {created_at: {scale: "7d", decay: 0.5}}
|
|
209
209
|
|
210
210
|
You can also boost by:
|
211
211
|
|
212
|
-
- [Conversions](#
|
212
|
+
- [Conversions](#intelligent-search)
|
213
213
|
- [Distance](#boost-by-distance)
|
214
214
|
|
215
215
|
### Get Everything
|
@@ -311,7 +311,7 @@ class Product < ApplicationRecord
|
|
311
311
|
end
|
312
312
|
```
|
313
313
|
|
314
|
-
See the [list of
|
314
|
+
See the [list of languages](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-stemmer-tokenfilter.html). A few languages require plugins:
|
315
315
|
|
316
316
|
- `chinese` - [analysis-ik plugin](https://github.com/medcl/elasticsearch-analysis-ik)
|
317
317
|
- `chinese2` - [analysis-smartcn plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/7.4/analysis-smartcn.html)
|
@@ -322,6 +322,14 @@ See the [list of stemmers](https://www.elastic.co/guide/en/elasticsearch/referen
|
|
322
322
|
- `ukrainian` - [analysis-ukrainian plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/7.4/analysis-ukrainian.html)
|
323
323
|
- `vietnamese` - [analysis-vietnamese plugin](https://github.com/duydo/elasticsearch-analysis-vietnamese)
|
324
324
|
|
325
|
+
You can also use a Hunspell dictionary for stemming.
|
326
|
+
|
327
|
+
```ruby
|
328
|
+
class Product < ApplicationRecord
|
329
|
+
searchkick stemmer: {type: "hunspell", locale: "en_US"}
|
330
|
+
end
|
331
|
+
```
|
332
|
+
|
325
333
|
Disable stemming with:
|
326
334
|
|
327
335
|
```ruby
|
@@ -1217,7 +1225,7 @@ Searchkick uses `ENV["ELASTICSEARCH_URL"]` for the Elasticsearch server. This de
|
|
1217
1225
|
- [Elastic Cloud](#elastic-cloud)
|
1218
1226
|
- [Heroku](#heroku)
|
1219
1227
|
- [Amazon Elasticsearch Service](#amazon-elasticsearch-service)
|
1220
|
-
- [Self-Hosted and Other](#other)
|
1228
|
+
- [Self-Hosted and Other](#self-hosted-and-other)
|
1221
1229
|
|
1222
1230
|
### Elastic Cloud
|
1223
1231
|
|
@@ -1469,7 +1477,7 @@ Product.search_index.promote(index_name, update_refresh_interval: true)
|
|
1469
1477
|
|
1470
1478
|
### Queuing
|
1471
1479
|
|
1472
|
-
Push ids of records needing
|
1480
|
+
Push ids of records needing reindexing to a queue and reindex in bulk for better performance. First, set up Redis in an initializer. We recommend using [connection_pool](https://github.com/mperham/connection_pool).
|
1473
1481
|
|
1474
1482
|
```ruby
|
1475
1483
|
Searchkick.redis = ConnectionPool.new { Redis.new }
|
data/lib/searchkick/index.rb
CHANGED
@@ -153,6 +153,7 @@ module Searchkick
|
|
153
153
|
}
|
154
154
|
}
|
155
155
|
|
156
|
+
raise ArgumentError, "Can't pass both language and stemmer" if options[:stemmer] && language
|
156
157
|
update_language(settings, language)
|
157
158
|
update_stemming(settings)
|
158
159
|
|
@@ -286,6 +287,18 @@ module Searchkick
|
|
286
287
|
end
|
287
288
|
|
288
289
|
def update_stemming(settings)
|
290
|
+
if options[:stemmer]
|
291
|
+
stemmer = options[:stemmer]
|
292
|
+
# could also support snowball and stemmer
|
293
|
+
case stemmer[:type]
|
294
|
+
when "hunspell"
|
295
|
+
# supports all token filter options
|
296
|
+
settings[:analysis][:filter][:searchkick_stemmer] = stemmer
|
297
|
+
else
|
298
|
+
raise ArgumentError, "Unknown stemmer: #{stemmer[:type]}"
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
289
302
|
stem = options[:stem]
|
290
303
|
|
291
304
|
# language analyzer used
|
data/lib/searchkick/model.rb
CHANGED
@@ -6,7 +6,7 @@ module Searchkick
|
|
6
6
|
unknown_keywords = options.keys - [:_all, :_type, :batch_size, :callbacks, :case_sensitive, :conversions, :deep_paging, :default_fields,
|
7
7
|
:filterable, :geo_shape, :highlight, :ignore_above, :index_name, :index_prefix, :inheritance, :language,
|
8
8
|
:locations, :mappings, :match, :merge_mappings, :routing, :searchable, :search_synonyms, :settings, :similarity,
|
9
|
-
:special_characters, :stem, :stem_conversions, :stem_exclusion, :stemmer_override, :suggest, :synonyms, :text_end,
|
9
|
+
:special_characters, :stem, :stemmer, :stem_conversions, :stem_exclusion, :stemmer_override, :suggest, :synonyms, :text_end,
|
10
10
|
:text_middle, :text_start, :word, :wordnet, :word_end, :word_middle, :word_start]
|
11
11
|
raise ArgumentError, "unknown keywords: #{unknown_keywords.join(", ")}" if unknown_keywords.any?
|
12
12
|
|
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.
|
4
|
+
version: 4.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
105
|
+
rubygems_version: 3.2.3
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Intelligent search made easy with Rails and Elasticsearch
|