searchkick 4.6.0 → 4.6.1
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/README.md +14 -13
- data/lib/searchkick/index.rb +1 -1
- data/lib/searchkick/query.rb +14 -3
- 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: d1d925c63766341731235f39ccc55ff9c897927692bd36e0cfd6038a1d371d29
|
4
|
+
data.tar.gz: c3b2f3597751a87b1498919c210fb25f5f14a0514632a5e4e351d54bc799cb63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e33b43ba33b0e832a7db8d65ffce7d83b5ca6e293b9d3049d1b8a4fee18c35a60a3353a8132e4baa5b77fca00b4d2eb383c5b4adfa8a089282befe19925aca82
|
7
|
+
data.tar.gz: 2e16bd24df683e543d81b1f272d8f67d42ef273c42de9d21f4366e001f39133161d714007aa0306077747d925c03c008f74b2b5ae5f0b4fe586daeba1aa8df66
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -103,19 +103,20 @@ Where
|
|
103
103
|
|
104
104
|
```ruby
|
105
105
|
where: {
|
106
|
-
expires_at: {gt: Time.now},
|
107
|
-
orders_count: 1..10,
|
108
|
-
aisle_id: [25, 30],
|
109
|
-
store_id: {not: 2},
|
110
|
-
aisle_id: {not: [25, 30]},
|
111
|
-
user_ids: {all: [1, 3]},
|
112
|
-
category: {like: "%frozen%"},
|
113
|
-
category:
|
114
|
-
category:
|
115
|
-
|
106
|
+
expires_at: {gt: Time.now}, # lt, gte, lte also available
|
107
|
+
orders_count: 1..10, # equivalent to {gte: 1, lte: 10}
|
108
|
+
aisle_id: [25, 30], # in
|
109
|
+
store_id: {not: 2}, # not
|
110
|
+
aisle_id: {not: [25, 30]}, # not in
|
111
|
+
user_ids: {all: [1, 3]}, # all elements in array
|
112
|
+
category: {like: "%frozen%"}, # like
|
113
|
+
category: {ilike: "%frozen%"}, # ilike
|
114
|
+
category: /frozen .+/, # regexp
|
115
|
+
category: {prefix: "frozen"}, # prefix
|
116
|
+
store_id: {exists: true}, # exists
|
116
117
|
_or: [{in_stock: true}, {backordered: true}],
|
117
118
|
_and: [{in_stock: true}, {backordered: true}],
|
118
|
-
_not: {store_id: 1}
|
119
|
+
_not: {store_id: 1} # negate a condition
|
119
120
|
}
|
120
121
|
```
|
121
122
|
|
@@ -1230,7 +1231,7 @@ Searchkick uses `ENV["ELASTICSEARCH_URL"]` for the Elasticsearch server. This de
|
|
1230
1231
|
|
1231
1232
|
- [Elastic Cloud](#elastic-cloud)
|
1232
1233
|
- [Heroku](#heroku)
|
1233
|
-
- [Amazon
|
1234
|
+
- [Amazon OpenSearch Service](#amazon-opensearch-service)
|
1234
1235
|
- [Self-Hosted and Other](#self-hosted-and-other)
|
1235
1236
|
|
1236
1237
|
### Elastic Cloud
|
@@ -1290,7 +1291,7 @@ Then deploy and reindex:
|
|
1290
1291
|
heroku run rake searchkick:reindex:all
|
1291
1292
|
```
|
1292
1293
|
|
1293
|
-
### Amazon
|
1294
|
+
### Amazon OpenSearch Service
|
1294
1295
|
|
1295
1296
|
Create an initializer `config/initializers/elasticsearch.rb` with:
|
1296
1297
|
|
data/lib/searchkick/index.rb
CHANGED
@@ -363,7 +363,7 @@ module Searchkick
|
|
363
363
|
end
|
364
364
|
rescue Elasticsearch::Transport::Transport::Errors::BadRequest => e
|
365
365
|
if e.message.include?("No handler for type [text]")
|
366
|
-
raise UnsupportedVersionError, "This version of Searchkick requires Elasticsearch
|
366
|
+
raise UnsupportedVersionError, "This version of Searchkick requires Elasticsearch 6 or greater"
|
367
367
|
end
|
368
368
|
|
369
369
|
raise e
|
data/lib/searchkick/query.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Searchkick
|
2
2
|
class Query
|
3
|
+
include Enumerable
|
3
4
|
extend Forwardable
|
4
5
|
|
5
6
|
@@metric_aggs = [:avg, :cardinality, :max, :min, :sum]
|
@@ -12,7 +13,8 @@ module Searchkick
|
|
12
13
|
:took, :error, :model_name, :entry_name, :total_count, :total_entries,
|
13
14
|
:current_page, :per_page, :limit_value, :padding, :total_pages, :num_pages,
|
14
15
|
:offset_value, :offset, :previous_page, :prev_page, :next_page, :first_page?, :last_page?,
|
15
|
-
:out_of_range?, :hits, :response, :to_a, :first, :scroll
|
16
|
+
:out_of_range?, :hits, :response, :to_a, :first, :scroll, :highlights, :with_highlights,
|
17
|
+
:with_score, :misspellings?, :scroll_id, :clear_scroll, :missing_records, :with_hit
|
16
18
|
|
17
19
|
def initialize(klass, term = "*", **options)
|
18
20
|
unknown_keywords = options.keys - [:aggs, :block, :body, :body_options, :boost,
|
@@ -959,7 +961,7 @@ module Searchkick
|
|
959
961
|
}
|
960
962
|
}
|
961
963
|
}
|
962
|
-
when :like
|
964
|
+
when :like, :ilike
|
963
965
|
# based on Postgres
|
964
966
|
# https://www.postgresql.org/docs/current/functions-matching.html
|
965
967
|
# % matches zero or more characters
|
@@ -973,7 +975,16 @@ module Searchkick
|
|
973
975
|
regex.gsub!(v, "\\" + v)
|
974
976
|
end
|
975
977
|
regex = regex.gsub(/(?<!\\)%/, ".*").gsub(/(?<!\\)_/, ".").gsub("\\%", "%").gsub("\\_", "_")
|
976
|
-
|
978
|
+
|
979
|
+
if op == :ilike
|
980
|
+
if below710?
|
981
|
+
raise ArgumentError, "ilike requires Elasticsearch 7.10+"
|
982
|
+
else
|
983
|
+
filters << {regexp: {field => {value: regex, flags: "NONE", case_insensitive: true}}}
|
984
|
+
end
|
985
|
+
else
|
986
|
+
filters << {regexp: {field => {value: regex, flags: "NONE"}}}
|
987
|
+
end
|
977
988
|
when :prefix
|
978
989
|
filters << {prefix: {field => {value: op_value}}}
|
979
990
|
when :regexp # support for regexp queries without using a regexp ruby object
|
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.6.
|
4
|
+
version: 4.6.1
|
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-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|