arelastic 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -48,10 +48,18 @@ module Arelastic
|
|
48
48
|
Arelastic::Filters::Exists.new field
|
49
49
|
end
|
50
50
|
|
51
|
+
def present
|
52
|
+
exists.and(not_eq(''))
|
53
|
+
end
|
54
|
+
|
51
55
|
def missing(options = {})
|
52
56
|
Arelastic::Filters::Missing.new field, options
|
53
57
|
end
|
54
58
|
|
59
|
+
def blank
|
60
|
+
missing.or(eq(''))
|
61
|
+
end
|
62
|
+
|
55
63
|
def gteq other
|
56
64
|
range 'gte' => other
|
57
65
|
end
|
@@ -68,10 +76,6 @@ module Arelastic
|
|
68
76
|
range 'lt' => other
|
69
77
|
end
|
70
78
|
|
71
|
-
def distance location, distance, options = {}
|
72
|
-
Arelastic::Filters::GeoDistance.new(field, location, distance, options)
|
73
|
-
end
|
74
|
-
|
75
79
|
private
|
76
80
|
def range options
|
77
81
|
Arelastic::Filters::Range.new field, options
|
@@ -49,17 +49,25 @@ class Arelastic::Builders::FilterTest < MiniTest::Spec
|
|
49
49
|
assert_equal expected, builder.exists.as_elastic
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
53
|
-
expected = {"
|
54
|
-
assert_equal expected, builder.
|
52
|
+
def test_present
|
53
|
+
expected = {"and" => [{"exists" => {"field"=>"color"}}, {"not" => {"term"=>{"color"=>""}}}]}
|
54
|
+
assert_equal expected, builder.present.as_elastic
|
55
55
|
end
|
56
56
|
|
57
|
-
def
|
58
|
-
expected = {"
|
59
|
-
assert_equal expected, builder.
|
57
|
+
def test_missing
|
58
|
+
expected = {"missing" => {"field" => "color"}}
|
59
|
+
assert_equal expected, builder.missing.as_elastic
|
60
|
+
end
|
60
61
|
|
61
|
-
|
62
|
-
|
62
|
+
def test_blank
|
63
|
+
expected = {"or" => [{"missing" => {"field"=>"color"}}, {"term" => {"color"=>""}}]}
|
64
|
+
assert_equal expected, builder.blank.as_elastic
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
def test_range
|
69
|
+
expected = {"range" => {"color" => {"lt" => 5}}}
|
70
|
+
assert_equal expected, builder.lt(5).as_elastic
|
63
71
|
end
|
64
72
|
|
65
73
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arelastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
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-09-
|
12
|
+
date: 2012-09-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Build Elastic Search queries with objects
|
15
15
|
email: developer@matthewhiggins.com
|