searchkick 4.6.1 → 4.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/searchkick/query.rb +16 -9
- 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: 65c7079048f9956249fbdc5ab791813dfd3fb46bf70942df3175010d40beeb4e
|
4
|
+
data.tar.gz: 54aafa84a70f1b8a2ca3d94ab73a82e6acfbdb5651406385375ba6afdc54c3de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cea309b06315f0094640dd799281d63cfaada2464da9b79961d04cac396b80f8e5e4599af419f239dc2eaf886813bdb73b88bdb9a27b9cd9582b01bef815e53e
|
7
|
+
data.tar.gz: 3252d012f15694d38d3956ffbff157869a36a8789980c3b5af4a24db9c8cb163adea7a78d3896eab073c1f9e5ae43b7532dad86e60663ca07c389e29ab26a181
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 4.6.2 (2021-11-15)
|
2
|
+
|
3
|
+
- Added support for beginless ranges to `where` option
|
4
|
+
- Fixed `like` and `ilike` with `+` character
|
5
|
+
- Fixed warning about accessing system indices when no model or index specified
|
6
|
+
|
1
7
|
## 4.6.1 (2021-09-25)
|
2
8
|
|
3
9
|
- Added `ilike` operator for Elasticsearch 7.10+
|
data/lib/searchkick/query.rb
CHANGED
@@ -75,7 +75,8 @@ module Searchkick
|
|
75
75
|
elsif searchkick_index
|
76
76
|
searchkick_index.name
|
77
77
|
else
|
78
|
-
|
78
|
+
# fixes warning about accessing system indices
|
79
|
+
"*,-.*"
|
79
80
|
end
|
80
81
|
|
81
82
|
params = {
|
@@ -904,12 +905,7 @@ module Searchkick
|
|
904
905
|
else
|
905
906
|
# expand ranges
|
906
907
|
if value.is_a?(Range)
|
907
|
-
|
908
|
-
if value.end.nil? || (value.end.respond_to?(:infinite?) && value.end.infinite?)
|
909
|
-
value = {gte: value.first}
|
910
|
-
else
|
911
|
-
value = {gte: value.first, (value.exclude_end? ? :lt : :lte) => value.last}
|
912
|
-
end
|
908
|
+
value = expand_range(value)
|
913
909
|
end
|
914
910
|
|
915
911
|
value = {in: value} if value.is_a?(Array)
|
@@ -969,10 +965,10 @@ module Searchkick
|
|
969
965
|
# \ is escape character
|
970
966
|
# escape Lucene reserved characters
|
971
967
|
# https://www.elastic.co/guide/en/elasticsearch/reference/current/regexp-syntax.html#regexp-optional-operators
|
972
|
-
reserved = %w(. ? + * | { } [ ] ( ) "
|
968
|
+
reserved = %w(\\ . ? + * | { } [ ] ( ) ")
|
973
969
|
regex = op_value.dup
|
974
970
|
reserved.each do |v|
|
975
|
-
regex.gsub!(v, "
|
971
|
+
regex.gsub!(v, "\\\\" + v)
|
976
972
|
end
|
977
973
|
regex = regex.gsub(/(?<!\\)%/, ".*").gsub(/(?<!\\)_/, ".").gsub("\\%", "%").gsub("\\_", "_")
|
978
974
|
|
@@ -1138,6 +1134,17 @@ module Searchkick
|
|
1138
1134
|
end
|
1139
1135
|
end
|
1140
1136
|
|
1137
|
+
def expand_range(range)
|
1138
|
+
expanded = {}
|
1139
|
+
expanded[:gte] = range.begin if range.begin
|
1140
|
+
|
1141
|
+
if range.end && !(range.end.respond_to?(:infinite?) && range.end.infinite?)
|
1142
|
+
expanded[range.exclude_end? ? :lt : :lte] = range.end
|
1143
|
+
end
|
1144
|
+
|
1145
|
+
expanded
|
1146
|
+
end
|
1147
|
+
|
1141
1148
|
def base_field(k)
|
1142
1149
|
k.sub(/\.(analyzed|word_start|word_middle|word_end|text_start|text_middle|text_end|exact)\z/, "")
|
1143
1150
|
end
|
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.2
|
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-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|