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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1d925c63766341731235f39ccc55ff9c897927692bd36e0cfd6038a1d371d29
4
- data.tar.gz: c3b2f3597751a87b1498919c210fb25f5f14a0514632a5e4e351d54bc799cb63
3
+ metadata.gz: 65c7079048f9956249fbdc5ab791813dfd3fb46bf70942df3175010d40beeb4e
4
+ data.tar.gz: 54aafa84a70f1b8a2ca3d94ab73a82e6acfbdb5651406385375ba6afdc54c3de
5
5
  SHA512:
6
- metadata.gz: e33b43ba33b0e832a7db8d65ffce7d83b5ca6e293b9d3049d1b8a4fee18c35a60a3353a8132e4baa5b77fca00b4d2eb383c5b4adfa8a089282befe19925aca82
7
- data.tar.gz: 2e16bd24df683e543d81b1f272d8f67d42ef273c42de9d21f4366e001f39133161d714007aa0306077747d925c03c008f74b2b5ae5f0b4fe586daeba1aa8df66
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+
@@ -75,7 +75,8 @@ module Searchkick
75
75
  elsif searchkick_index
76
76
  searchkick_index.name
77
77
  else
78
- "_all"
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
- # infinite? added in Ruby 2.4
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, "\\" + 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
@@ -1,3 +1,3 @@
1
1
  module Searchkick
2
- VERSION = "4.6.1"
2
+ VERSION = "4.6.2"
3
3
  end
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.1
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-09-25 00:00:00.000000000 Z
11
+ date: 2021-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel