daedal 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Gemfile.lock +2 -4
- data/README.md +2 -1
- data/lib/daedal/filters/terms_filter.rb +8 -1
- data/lib/daedal/version.rb +1 -1
- data/spec/unit/daedal/filters/terms_filter_spec.rb +12 -0
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MmUzY2NmNzA3MzE4ZDQ2N2EyZWRhODA5YjFiNzIyYjdiOTA0MTI5Yg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ebac4bd85f7c907672a838d333679a3b8d46bd0c
|
4
|
+
data.tar.gz: ac87f2b4e1ea3fbf0eef292f848019e4616a7a4d
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NmY0NTRhMGI3NWE1NzY5NjljMjViMmIxMWJiNGU1MzhjMzFiMjExZTg4ZmI2
|
11
|
-
ZWJmOWRkZDFkNjljN2Q0ZjA0OTc3ZWYwNjEwY2RkNzMyMjMzZmQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MTM4OWNjZTkxMmM1NDM3ODc4MjY0YWRhMWVhMjdkYjUyOTFmZWI2ODgxMzZi
|
14
|
-
YWE4NzQ5OGRlNjczNjdkNjYxOGU2ZjE1ZGZmNmRjOTVkZjEwMGU4NDQzNWE4
|
15
|
-
OTJiNmQ2ZGU3MDNmY2M3MjRlOGZmMTlkNDdiMDdiOGMxMDFmOWI=
|
6
|
+
metadata.gz: 1d4470546828b9f1606dd3244415a6c7dde5bc9a09c33de3f6d938755b3afcfd2a88537a4a90700cc3393b43d782f43612dbe763daa7f80a119b729c6455892b
|
7
|
+
data.tar.gz: 3c2929aa9091ef19e74b3a73d3363b7e3c62241de83bb9071a52ce2d747382f1eea20bbe013b37d07d353e09b160069c1e1d2765b1bd5b7827ebb1f21dc650fa
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
daedal (0.0.
|
4
|
+
daedal (0.0.12)
|
5
5
|
virtus (>= 1.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
atomic (1.1.16)
|
11
10
|
axiom-types (0.1.1)
|
12
11
|
descendants_tracker (~> 0.0.4)
|
13
12
|
ice_nine (~> 0.11.0)
|
@@ -78,8 +77,7 @@ GEM
|
|
78
77
|
term-ansicolor (1.2.2)
|
79
78
|
tins (~> 0.8)
|
80
79
|
thor (0.18.1)
|
81
|
-
thread_safe (0.3.
|
82
|
-
atomic (>= 1.1.7, < 2)
|
80
|
+
thread_safe (0.3.3)
|
83
81
|
timers (1.1.0)
|
84
82
|
tins (0.13.1)
|
85
83
|
virtus (1.0.2)
|
data/README.md
CHANGED
@@ -137,6 +137,7 @@ Currently, the following filters have been implemented:
|
|
137
137
|
* [term filter](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-term-filter.html)
|
138
138
|
* [terms filter](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-terms-filter.html)
|
139
139
|
* [nested filter](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-nested-filter.html)
|
140
|
+
* [exists filter](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-exists-filter.html)
|
140
141
|
|
141
142
|
### Type checking and attribute coercion
|
142
143
|
|
@@ -191,9 +192,9 @@ class PlayQuery < Daedal::Queries::Query
|
|
191
192
|
# define the parameters that you want in your query
|
192
193
|
# if the field is optional, make sure to set required to false
|
193
194
|
attribute :author, String
|
195
|
+
attribute :title, String
|
194
196
|
|
195
197
|
attribute :characters, Array[String], required: false
|
196
|
-
attribute :title, String, required: false
|
197
198
|
|
198
199
|
def construct_query
|
199
200
|
author_query = Daedal::Queries::MatchQuery.new(field: 'author', query: author)
|
@@ -6,9 +6,16 @@ module Daedal
|
|
6
6
|
# required attributes
|
7
7
|
attribute :field, Daedal::Attributes::Field
|
8
8
|
attribute :terms, Array[Daedal::Attributes::QueryValue]
|
9
|
+
|
10
|
+
# not required
|
11
|
+
attribute :execution, Daedal::Attributes::QueryValue, required: false
|
9
12
|
|
10
13
|
def to_hash
|
11
|
-
{terms: {field => terms}}
|
14
|
+
result = {terms: {field => terms}}
|
15
|
+
unless execution.nil?
|
16
|
+
result[:terms][:execution] = execution
|
17
|
+
end
|
18
|
+
result
|
12
19
|
end
|
13
20
|
end
|
14
21
|
end
|
data/lib/daedal/version.rb
CHANGED
@@ -48,4 +48,16 @@ describe Daedal::Filters::TermsFilter do
|
|
48
48
|
expect(filter.to_json).to eq hash_filter.to_json
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
52
|
+
context 'with an execution mode' do
|
53
|
+
let(:filter) do
|
54
|
+
subject.new(field: field, terms: terms, execution: :and)
|
55
|
+
end
|
56
|
+
let(:hash_filter) do
|
57
|
+
{terms: {field => terms, execution: :and}}
|
58
|
+
end
|
59
|
+
it 'will set the execution mode correctly' do
|
60
|
+
expect(filter.to_hash).to eq hash_filter
|
61
|
+
end
|
62
|
+
end
|
51
63
|
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daedal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Schuch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.0.0
|
27
27
|
description: Classes for easier ElasticSearch query creation
|
@@ -30,9 +30,9 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
-
- .gitignore
|
34
|
-
- .rspec
|
35
|
-
- .travis.yml
|
33
|
+
- ".gitignore"
|
34
|
+
- ".rspec"
|
35
|
+
- ".travis.yml"
|
36
36
|
- Gemfile
|
37
37
|
- Gemfile.lock
|
38
38
|
- Guardfile
|
@@ -108,17 +108,17 @@ require_paths:
|
|
108
108
|
- lib
|
109
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- -
|
111
|
+
- - ">="
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.2.
|
121
|
+
rubygems_version: 2.2.2
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: ElasticSearch Query DSL Builders
|