arelastic 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/arelastic/facets.rb +2 -1
- data/lib/arelastic/facets/facet.rb +3 -0
- data/lib/arelastic/facets/nested.rb +9 -0
- data/lib/arelastic/filters/filter.rb +4 -0
- data/lib/arelastic/nodes/node.rb +4 -0
- data/test/arelastic/builders/facet_test.rb +9 -0
- data/test/arelastic/facets/facet_test.rb +31 -0
- data/test/arelastic/facets/histogram_test.rb +1 -1
- data/test/arelastic/filters/filter_test.rb +9 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70bfaded4af81b93d4ab0548c586a128a790a794
|
4
|
+
data.tar.gz: cadf4637b3c585aa297ded7ada84535c8455911f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 336c9c1902878d897cfb09d2ca0fdcdbe5e02c6241e6c15de160a3727868160f5102f9ef3f00d174e3df43c26477e26e705bd07a021cbdc746173d8171cf8a51
|
7
|
+
data.tar.gz: ef592219177802e984bc79c0cc3378e2aaa230fa089503ea616f3bbb69677530c2a9200f0175bffbe483ce5ce0ec0286969001f1fc8e5eee921acf3162a3389c
|
data/lib/arelastic/facets.rb
CHANGED
data/lib/arelastic/nodes/node.rb
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class Arelastic::Builders::FacetTest < MiniTest::Unit::TestCase
|
4
|
+
def test_terms
|
5
|
+
expected = {"name"=>{"terms"=>{"field"=>"term"}}}
|
6
|
+
actual = Arelastic::Builders::Facet['name'].terms('term').as_elastic
|
7
|
+
assert_equal expected, actual
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class Arelastic::Facets::FacetTest < MiniTest::Unit::TestCase
|
4
|
+
def test_nested
|
5
|
+
facet = Arelastic::Facets::Facet.new
|
6
|
+
expected = {
|
7
|
+
"nested" => "links"
|
8
|
+
}
|
9
|
+
|
10
|
+
nested = facet.nested "links"
|
11
|
+
|
12
|
+
assert_equal expected, nested.as_elastic
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_nested_terms
|
16
|
+
facet = Arelastic::Facets::Terms.new('foo', 'links.name', "size" => 10)
|
17
|
+
expected = {
|
18
|
+
"foo" => {
|
19
|
+
"terms" => {
|
20
|
+
"field" => "links.name",
|
21
|
+
"size" => 10,
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"nested" => "links"
|
25
|
+
}
|
26
|
+
|
27
|
+
nested = facet.nested "links"
|
28
|
+
|
29
|
+
assert_equal expected, nested.as_elastic
|
30
|
+
end
|
31
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class Arelastic::Facets::
|
3
|
+
class Arelastic::Facets::HistogramTest < MiniTest::Unit::TestCase
|
4
4
|
def test_as_elastic
|
5
5
|
facet = Arelastic::Facets::Histogram.new('histo', "field" => "field_name", "interval" => 100)
|
6
6
|
expected = {
|
@@ -27,4 +27,13 @@ class Arelastic::FilterTest < MiniTest::Unit::TestCase
|
|
27
27
|
assert negated_filter.is_a?(Arelastic::Filters::Not)
|
28
28
|
assert_equal filter, negated_filter.expr
|
29
29
|
end
|
30
|
+
|
31
|
+
def test_nested
|
32
|
+
filter = Arelastic::Filters::Term.new('foo', 'bar').nested('links')
|
33
|
+
|
34
|
+
nested_filter = filter.nested 'links'
|
35
|
+
|
36
|
+
assert nested_filter.is_a?(Arelastic::Filters::Nested)
|
37
|
+
assert_equal filter, nested_filter.expr
|
38
|
+
end
|
30
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arelastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Higgins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build Elastic Search queries with objects
|
14
14
|
email: developer@matthewhiggins.com
|
@@ -30,6 +30,7 @@ files:
|
|
30
30
|
- lib/arelastic/builders.rb
|
31
31
|
- lib/arelastic/facets/facet.rb
|
32
32
|
- lib/arelastic/facets/histogram.rb
|
33
|
+
- lib/arelastic/facets/nested.rb
|
33
34
|
- lib/arelastic/facets/range.rb
|
34
35
|
- lib/arelastic/facets/terms.rb
|
35
36
|
- lib/arelastic/facets.rb
|
@@ -91,11 +92,13 @@ files:
|
|
91
92
|
- test/arelastic/arities/binary_test.rb
|
92
93
|
- test/arelastic/arities/polyadic_test.rb
|
93
94
|
- test/arelastic/arities/unary_test.rb
|
95
|
+
- test/arelastic/builders/facet_test.rb
|
94
96
|
- test/arelastic/builders/filter_test.rb
|
95
97
|
- test/arelastic/builders/mapping_test.rb
|
96
98
|
- test/arelastic/builders/query_test.rb
|
97
99
|
- test/arelastic/builders/search_test.rb
|
98
100
|
- test/arelastic/builders/sort_test.rb
|
101
|
+
- test/arelastic/facets/facet_test.rb
|
99
102
|
- test/arelastic/facets/histogram_test.rb
|
100
103
|
- test/arelastic/facets/terms_test.rb
|
101
104
|
- test/arelastic/filters/exists_test.rb
|
@@ -143,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
146
|
version: 1.8.11
|
144
147
|
requirements: []
|
145
148
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.0.
|
149
|
+
rubygems_version: 2.0.3
|
147
150
|
signing_key:
|
148
151
|
specification_version: 4
|
149
152
|
summary: Elastic Search query builder
|