elastic_record 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'elastic_record'
5
- s.version = '0.9.2'
5
+ s.version = '0.9.3'
6
6
  s.summary = 'Use Elastic Search with your objects'
7
7
  s.description = 'Find your records with elastic search'
8
8
 
@@ -168,6 +168,8 @@ module ElasticRecord
168
168
  nodes << arelastic[field].in(terms)
169
169
  when Hash
170
170
  nodes << {field => terms}
171
+ when nil
172
+ nodes << arelastic[field].missing
171
173
  else
172
174
  nodes << arelastic[field].eq(terms)
173
175
  end
@@ -216,4 +218,4 @@ module ElasticRecord
216
218
  end
217
219
  end
218
220
  end
219
- end
221
+ end
@@ -76,6 +76,22 @@ class ElasticRecord::Relation::SearchMethodsTest < MiniTest::Spec
76
76
  assert_equal expected, relation.as_elastic['query']
77
77
  end
78
78
 
79
+ def test_filter_with_nil
80
+ relation.filter! 'name' => nil
81
+
82
+ expected = {
83
+ "constant_score" => {
84
+ "filter" => {
85
+ "missing" => {
86
+ "field" => "name"
87
+ }
88
+ }
89
+ }
90
+ }
91
+
92
+ assert_equal expected, relation.as_elastic['query']
93
+ end
94
+
79
95
  def test_query_with_only_query
80
96
  relation.query!('foo')
81
97
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-13 00:00:00.000000000 Z
12
+ date: 2012-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: arelastic