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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07f59256aabbab61856a138e8fe03c35869d1458
4
- data.tar.gz: 8058c713097d4abdaa99c31876ca4004a47cdff8
3
+ metadata.gz: aefcfdc55dd8c8f5658800f98f9ee4c94997aa8f
4
+ data.tar.gz: 6d43e6870c57ef8e0931314376a62d78e83b504c
5
5
  SHA512:
6
- metadata.gz: de4a47668f6a772019ccb19605e3a1084a187cf73efe232d23eb4c8d98db9a74960a52ff022888754d9e27f6a3e81937baefdc82a7719ffcf9f22250d9b65f9e
7
- data.tar.gz: b4a33f99f145257dd727f2f5303976e97ae6e4de54262fa267c68d2b4586f804d6804fec20df64570ae3b50d7875af163f5bb943febdc49a4f89bcef9eb8fe6e
6
+ metadata.gz: bec7b252b2b26e839134568d77b8a3485affd44dabd8c5226f5f17dcac9d70b9fa42f58dcb87dab44e8555aae88676396eaa77f7fceed165a6d8924fb8cfaf8d
7
+ data.tar.gz: a95dfe3d216b26a227c9992896a0547d1a5e569aca087eb03272629842aafa6bc9f1190e74b956dc8efb7cbaac45286e41f49e1b26e90cdfe932e00555e8bfb7
@@ -1,6 +1,7 @@
1
1
  require 'arelastic/facets/facet'
2
2
 
3
+ require 'arelastic/facets/date_histogram'
3
4
  require 'arelastic/facets/histogram'
4
5
  require 'arelastic/facets/range'
5
6
  require 'arelastic/facets/terms'
6
- require 'arelastic/facets/nested'
7
+ require 'arelastic/facets/nested'
@@ -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.0
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-09-22 00:00:00.000000000 Z
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