arelastic 0.4.8 → 0.4.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b36f88b599cae804c7e7f5af5818e3e84ae64e3b
4
- data.tar.gz: cead67fef76a5f9ef60191e6a7e2c25320b20494
3
+ metadata.gz: 73f29f697aefe2d60254f5af115127179bf7ae6d
4
+ data.tar.gz: b1fa8a4ec1892bc04495e8eff66a539a8992291e
5
5
  SHA512:
6
- metadata.gz: 042084c662be6162335c33ae2fef809ec897bb3f0ca65024b4e26fce7f2aa7848ae3fc3acf8d3af0fb6670f8c413a4baca15b2fddd0f4b2902f1bb391ea3227f
7
- data.tar.gz: 270ecdf17ae308e953b7adf91b4c9b7eedc67559f912e666ffdadc76184c66dc1a88ce7f4c1ed9d944438f370896b4ed38c6372ca8b33de9d02a1056d5b1645a
6
+ metadata.gz: 9f3c836336f347ae0fc11d852179da1546038fe5a4b99ba3f25e33703714a7ad5ed7868e67e2c8159f0a296e101c7b47fb58c528db8fe499cf3915fa2f3ecaff
7
+ data.tar.gz: 7403f24c9302de7c95f234d14379586408a9eaea5f4d39f03e0afef9d1ebc143616bf9a1a80d934acb9517e7404f77986a7755ffb2d812981040656124218f25
@@ -14,5 +14,6 @@ require 'arelastic/filters/or'
14
14
  require 'arelastic/filters/prefix'
15
15
  require 'arelastic/filters/query'
16
16
  require 'arelastic/filters/range'
17
+ require 'arelastic/filters/script'
17
18
  require 'arelastic/filters/term'
18
19
  require 'arelastic/filters/terms'
@@ -0,0 +1,17 @@
1
+ module Arelastic
2
+ module Filters
3
+ class Script < Arelastic::Filters::Filter
4
+ attr_reader :script, :options
5
+
6
+ def initialize script, options = {}
7
+ @script = script
8
+ @options = options
9
+ end
10
+
11
+ def as_elastic
12
+ params = {"script" => script}.update(options)
13
+ {"script" => params}
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ require 'helper'
2
+
3
+ class Arelastic::Filters::ScriptTest < MiniTest::Unit::TestCase
4
+ def test_as_elastic
5
+ expected = {"script" => {"script" => "doc['color'].value.charAt(0) == 'r'"}}
6
+
7
+ assert_equal expected, Arelastic::Filters::Script.new("doc['color'].value.charAt(0) == 'r'").as_elastic
8
+ end
9
+
10
+ def test_with_options
11
+ expected = {"script" => {"script" => "doc['color'].value.length() == length", "params" => {"length" => 3}}}
12
+
13
+ assert_equal expected, Arelastic::Filters::Script.new("doc['color'].value.length() == length", 'params' => {"length" => 3}).as_elastic
14
+ end
15
+ 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.8
4
+ version: 0.4.9
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-23 00:00:00.000000000 Z
11
+ date: 2014-04-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Build Elastic Search queries with objects
14
14
  email: developer@matthewhiggins.com
@@ -17,23 +17,26 @@ extensions: []
17
17
  extra_rdoc_files:
18
18
  - README.rdoc
19
19
  files:
20
+ - README.rdoc
21
+ - lib/arelastic.rb
22
+ - lib/arelastic/arities.rb
20
23
  - lib/arelastic/arities/binary.rb
21
24
  - lib/arelastic/arities/polyadic.rb
22
25
  - lib/arelastic/arities/unary.rb
23
- - lib/arelastic/arities.rb
26
+ - lib/arelastic/builders.rb
24
27
  - lib/arelastic/builders/facet.rb
25
28
  - lib/arelastic/builders/filter.rb
26
29
  - lib/arelastic/builders/mapping.rb
27
30
  - lib/arelastic/builders/query.rb
28
31
  - lib/arelastic/builders/search.rb
29
32
  - lib/arelastic/builders/sort.rb
30
- - lib/arelastic/builders.rb
33
+ - lib/arelastic/facets.rb
31
34
  - lib/arelastic/facets/facet.rb
32
35
  - lib/arelastic/facets/histogram.rb
33
36
  - lib/arelastic/facets/nested.rb
34
37
  - lib/arelastic/facets/range.rb
35
38
  - lib/arelastic/facets/terms.rb
36
- - lib/arelastic/facets.rb
39
+ - lib/arelastic/filters.rb
37
40
  - lib/arelastic/filters/and.rb
38
41
  - lib/arelastic/filters/exists.rb
39
42
  - lib/arelastic/filters/filter.rb
@@ -49,9 +52,10 @@ files:
49
52
  - lib/arelastic/filters/prefix.rb
50
53
  - lib/arelastic/filters/query.rb
51
54
  - lib/arelastic/filters/range.rb
55
+ - lib/arelastic/filters/script.rb
52
56
  - lib/arelastic/filters/term.rb
53
57
  - lib/arelastic/filters/terms.rb
54
- - lib/arelastic/filters.rb
58
+ - lib/arelastic/mappings.rb
55
59
  - lib/arelastic/mappings/type.rb
56
60
  - lib/arelastic/mappings/types/binary.rb
57
61
  - lib/arelastic/mappings/types/boolean.rb
@@ -60,10 +64,10 @@ files:
60
64
  - lib/arelastic/mappings/types/number.rb
61
65
  - lib/arelastic/mappings/types/object.rb
62
66
  - lib/arelastic/mappings/types/string.rb
63
- - lib/arelastic/mappings.rb
67
+ - lib/arelastic/nodes.rb
64
68
  - lib/arelastic/nodes/hash_group.rb
65
69
  - lib/arelastic/nodes/node.rb
66
- - lib/arelastic/nodes.rb
70
+ - lib/arelastic/queries.rb
67
71
  - lib/arelastic/queries/bool.rb
68
72
  - lib/arelastic/queries/constant_score.rb
69
73
  - lib/arelastic/queries/field.rb
@@ -76,7 +80,7 @@ files:
76
80
  - lib/arelastic/queries/query_string.rb
77
81
  - lib/arelastic/queries/term.rb
78
82
  - lib/arelastic/queries/terms.rb
79
- - lib/arelastic/queries.rb
83
+ - lib/arelastic/searches.rb
80
84
  - lib/arelastic/searches/facets.rb
81
85
  - lib/arelastic/searches/filter.rb
82
86
  - lib/arelastic/searches/from.rb
@@ -84,11 +88,9 @@ files:
84
88
  - lib/arelastic/searches/search.rb
85
89
  - lib/arelastic/searches/size.rb
86
90
  - lib/arelastic/searches/sort.rb
87
- - lib/arelastic/searches.rb
91
+ - lib/arelastic/sorts.rb
88
92
  - lib/arelastic/sorts/asc.rb
89
93
  - lib/arelastic/sorts/sort.rb
90
- - lib/arelastic/sorts.rb
91
- - lib/arelastic.rb
92
94
  - test/arelastic/arities/binary_test.rb
93
95
  - test/arelastic/arities/polyadic_test.rb
94
96
  - test/arelastic/arities/unary_test.rb
@@ -112,6 +114,7 @@ files:
112
114
  - test/arelastic/filters/nested_test.rb
113
115
  - test/arelastic/filters/not_test.rb
114
116
  - test/arelastic/filters/query_test.rb
117
+ - test/arelastic/filters/script_test.rb
115
118
  - test/arelastic/mappings/types/binary_test.rb
116
119
  - test/arelastic/mappings/types/multi_field_test.rb
117
120
  - test/arelastic/mappings/types/string_test.rb
@@ -125,7 +128,6 @@ files:
125
128
  - test/arelastic/searches/sort_test.rb
126
129
  - test/arelastic/sorts/sort_test.rb
127
130
  - test/helper.rb
128
- - README.rdoc
129
131
  homepage: http://github.com/matthuhiggins/arelastic
130
132
  licenses:
131
133
  - MIT
@@ -136,17 +138,17 @@ require_paths:
136
138
  - lib
137
139
  required_ruby_version: !ruby/object:Gem::Requirement
138
140
  requirements:
139
- - - '>='
141
+ - - ">="
140
142
  - !ruby/object:Gem::Version
141
143
  version: 1.9.3
142
144
  required_rubygems_version: !ruby/object:Gem::Requirement
143
145
  requirements:
144
- - - '>='
146
+ - - ">="
145
147
  - !ruby/object:Gem::Version
146
148
  version: 1.8.11
147
149
  requirements: []
148
150
  rubyforge_project:
149
- rubygems_version: 2.0.3
151
+ rubygems_version: 2.2.1
150
152
  signing_key:
151
153
  specification_version: 4
152
154
  summary: Elastic Search query builder