searchkick 0.3.2 → 0.3.3
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 +1 -1
- data/lib/searchkick/model.rb +1 -1
- data/lib/searchkick/search.rb +17 -2
- data/lib/searchkick/version.rb +1 -1
- data/test/sql_test.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32cdf7dc806463087e8de7a1178b759b18621a3e
|
4
|
+
data.tar.gz: 354388509186cbd11616c958832182a892aacff9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0154a4d77e5c9308a26c8524db04dbbe75b471ab5875835cb1d0c0594e0543e1e7bd9bb8f31384eb166bb513af6faede705d11964942674ec9452df7b113aac3
|
7
|
+
data.tar.gz: f5477b6069d310f813a2e0f84a6452920583458ba4ded63cc973976181dcf033271d90e3d30e5d7c1edbc3288bc4516adcbaee29dcbb12c96ebb7639e9c263c5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/searchkick/model.rb
CHANGED
data/lib/searchkick/search.rb
CHANGED
@@ -218,7 +218,11 @@ module Searchkick
|
|
218
218
|
end
|
219
219
|
end
|
220
220
|
else
|
221
|
-
|
221
|
+
if value.nil?
|
222
|
+
filters << {missing: {"field" => field, existence: true, null_value: true}}
|
223
|
+
else
|
224
|
+
filters << {term: {field => value}}
|
225
|
+
end
|
222
226
|
end
|
223
227
|
end
|
224
228
|
end
|
@@ -291,7 +295,18 @@ module Searchkick
|
|
291
295
|
tire_options = {load: load, payload: payload, size: per_page, from: offset}
|
292
296
|
tire_options[:type] = document_type if self != searchkick_klass
|
293
297
|
search = Tire::Search::Search.new(index_name, tire_options)
|
294
|
-
|
298
|
+
begin
|
299
|
+
response = search.json
|
300
|
+
rescue Tire::Search::SearchRequestFailed => e
|
301
|
+
status_code = e.message[0..3].to_i
|
302
|
+
if status_code == 404
|
303
|
+
raise "Index missing - run #{searchkick_klass.name}.reindex"
|
304
|
+
elsif status_code == 500 and e.message.include?("IllegalArgumentException[minimumSimilarity >= 1]")
|
305
|
+
raise "Upgrade Elasticsearch to 0.90.0 or greater"
|
306
|
+
else
|
307
|
+
raise e
|
308
|
+
end
|
309
|
+
end
|
295
310
|
|
296
311
|
# apply facet limit in client due to
|
297
312
|
# https://github.com/elasticsearch/elasticsearch/issues/1305
|
data/lib/searchkick/version.rb
CHANGED
data/test/sql_test.rb
CHANGED
@@ -75,6 +75,14 @@ class TestSql < Minitest::Unit::TestCase
|
|
75
75
|
assert_search "product", ["Product A"], where: {color: ["RED"]}
|
76
76
|
end
|
77
77
|
|
78
|
+
def test_where_nil
|
79
|
+
store [
|
80
|
+
{name: "Product A"},
|
81
|
+
{name: "Product B", color: "red"}
|
82
|
+
]
|
83
|
+
assert_search "product", ["Product A"], where: {color: nil}
|
84
|
+
end
|
85
|
+
|
78
86
|
def test_near
|
79
87
|
store [
|
80
88
|
{name: "San Francisco", latitude: 37.7833, longitude: -122.4167},
|
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: 0.3.
|
4
|
+
version: 0.3.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: 2013-11-
|
11
|
+
date: 2013-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tire
|