arelastic 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arelastic/facets.rb +2 -1
- data/lib/arelastic/facets/date_histogram.rb +18 -0
- data/test/arelastic/facets/date_histogram.rb +17 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aefcfdc55dd8c8f5658800f98f9ee4c94997aa8f
|
4
|
+
data.tar.gz: 6d43e6870c57ef8e0931314376a62d78e83b504c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bec7b252b2b26e839134568d77b8a3485affd44dabd8c5226f5f17dcac9d70b9fa42f58dcb87dab44e8555aae88676396eaa77f7fceed165a6d8924fb8cfaf8d
|
7
|
+
data.tar.gz: a95dfe3d216b26a227c9992896a0547d1a5e569aca087eb03272629842aafa6bc9f1190e74b956dc8efb7cbaac45286e41f49e1b26e90cdfe932e00555e8bfb7
|
data/lib/arelastic/facets.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Arelastic
|
2
|
+
module Facets
|
3
|
+
class DateHistogram < Arelastic::Facets::Facet
|
4
|
+
attr_accessor :options
|
5
|
+
|
6
|
+
def initialize name, options
|
7
|
+
super name
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
def as_elastic_facet
|
12
|
+
{
|
13
|
+
"date_histogram" => options
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class Arelastic::Facets::DateHistogramTest < MiniTest::Unit::TestCase
|
4
|
+
def test_as_elastic
|
5
|
+
facet = Arelastic::Facets::DateHistogram.new('histo', "field" => "field_name", "interval" => "day")
|
6
|
+
expected = {
|
7
|
+
"histo" => {
|
8
|
+
"date_histogram" => {
|
9
|
+
"field" => "field_name",
|
10
|
+
"interval" => "day"
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
assert_equal expected, facet.as_elastic
|
16
|
+
end
|
17
|
+
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.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Higgins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build Elastic Search queries with objects
|
14
14
|
email: developer@matthewhiggins.com
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- lib/arelastic/builders/search.rb
|
37
37
|
- lib/arelastic/builders/sort.rb
|
38
38
|
- lib/arelastic/facets.rb
|
39
|
+
- lib/arelastic/facets/date_histogram.rb
|
39
40
|
- lib/arelastic/facets/facet.rb
|
40
41
|
- lib/arelastic/facets/histogram.rb
|
41
42
|
- lib/arelastic/facets/nested.rb
|
@@ -109,6 +110,7 @@ files:
|
|
109
110
|
- test/arelastic/builders/query_test.rb
|
110
111
|
- test/arelastic/builders/search_test.rb
|
111
112
|
- test/arelastic/builders/sort_test.rb
|
113
|
+
- test/arelastic/facets/date_histogram.rb
|
112
114
|
- test/arelastic/facets/facet_test.rb
|
113
115
|
- test/arelastic/facets/histogram_test.rb
|
114
116
|
- test/arelastic/facets/terms_test.rb
|