arelastic 1.2.0 → 1.3.0

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: d79ffe813785f55f0bd3e040733b153097536ce7
4
- data.tar.gz: bee96019633d9749923bd18c89e98f6534a77f99
3
+ metadata.gz: a0a7a0a703d0ab5dd36a676449fc8bfa2cdc20b7
4
+ data.tar.gz: 8f79e245f42b144533d1fa2c17883c824b091cf2
5
5
  SHA512:
6
- metadata.gz: a9ec7ea6554904b71cc2b2d3df584f50650ce0c8a298df1c9bb119c126a1d739c5e581f98a07773c7412e80e7b3cc191e268c7fefb19ba186d43094abf2271fa
7
- data.tar.gz: 55d443c8e3f3a8cc67699d8096c62a527bdab3306d3b3748aa15085ad5c9e57d708e3c6815c11a5816d6fdcbe75f2a2b3e446e1a37f2d09efd3c4a87f84bb195
6
+ metadata.gz: 660f7f84062fab516fea41a0e7b0e35365c5032d6c955ca799f199917ed98bd5e9bb4b7b3305d0a415e5332c4354eb578dbc02761f9f4e9e332487d9c10615a6
7
+ data.tar.gz: 2ddf09ade0864e340bda0f6a4e5e865e345acd15fe5ba428b32babc35f9c6e06e74bad220186629a63194afd5588651d098d1e79cabf40e50613ddee953ff319
@@ -1,6 +1,6 @@
1
1
  module Arelastic
2
2
  module Filters
3
- class Filter < Arelastic::Nodes::Node
3
+ class Filter < Arelastic::Queries::Query
4
4
  def or other
5
5
  Arelastic::Filters::Or.new [self, other]
6
6
  end
@@ -9,10 +9,6 @@ module Arelastic
9
9
  Arelastic::Filters::And.new [self, other]
10
10
  end
11
11
 
12
- def negate
13
- Arelastic::Filters::Not.new self
14
- end
15
-
16
12
  def nested path
17
13
  Arelastic::Filters::Nested.new path, self
18
14
  end
@@ -16,4 +16,4 @@ module Arelastic
16
16
  end
17
17
  end
18
18
  end
19
- end
19
+ end
@@ -4,6 +4,10 @@ module Arelastic
4
4
  def nested path
5
5
  Arelastic::Queries::Nested.new path, self
6
6
  end
7
+
8
+ def negate
9
+ Arelastic::Queries::Bool.new must_not: self
10
+ end
7
11
  end
8
12
  end
9
13
  end
data/lib/arelastic.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  require 'arelastic/arities'
2
2
  require 'arelastic/nodes'
3
3
  require 'arelastic/aggregations'
4
+ require 'arelastic/queries'
4
5
  require 'arelastic/filters'
5
6
  require 'arelastic/mappings'
6
- require 'arelastic/queries'
7
7
  require 'arelastic/searches'
8
8
  require 'arelastic/sorts'
9
9
 
@@ -19,15 +19,6 @@ class Arelastic::FilterTest < Minitest::Test
19
19
  assert_equal [filter, filter], and_filter.children
20
20
  end
21
21
 
22
- def test_negate
23
- filter = Arelastic::Filters::Term.new 'foo', 'bar'
24
-
25
- negated_filter = filter.negate
26
-
27
- assert negated_filter.is_a?(Arelastic::Filters::Not)
28
- assert_equal filter, negated_filter.expr
29
- end
30
-
31
22
  def test_nested
32
23
  filter = Arelastic::Filters::Term.new('foo', 'bar')
33
24
 
@@ -15,4 +15,13 @@ class Arelastic::Queries::QueryTest < Minitest::Test
15
15
  }
16
16
  assert_equal(expected, nested_query.as_elastic)
17
17
  end
18
+
19
+ def test_negate
20
+ filter = Arelastic::Queries::Term.new 'foo', 'bar'
21
+
22
+ negated_filter = filter.negate
23
+
24
+ assert negated_filter.is_a?(Arelastic::Queries::Bool)
25
+ assert_equal filter, negated_filter.options[:must_not]
26
+ end
18
27
  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: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Higgins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-06 00:00:00.000000000 Z
11
+ date: 2016-06-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Build Elastic Search queries with objects
14
14
  email: developer@matthewhiggins.com
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  version: 1.8.11
167
167
  requirements: []
168
168
  rubyforge_project:
169
- rubygems_version: 2.4.5.1
169
+ rubygems_version: 2.5.1
170
170
  signing_key:
171
171
  specification_version: 4
172
172
  summary: Elastic Search query builder