arelastic 2.5.0 → 2.6.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
  SHA256:
3
- metadata.gz: f7edbcecc9f2338f91c04f02153e5be31d1b31dbe0c3f2f8d8ae459a1390ff1c
4
- data.tar.gz: ba5a7048b7602c5ac6a1ddbcd35578a14e81f46987665e2f2d3227bce69e3a8b
3
+ metadata.gz: 87e0d3a33fb5774804affcdeaba8652d46064a8d3cff6e8d1e423ca7d7c43703
4
+ data.tar.gz: c0a30e25ca73dfdd542ada6d7109c595f8448c026e18485bb2618d5104a6eb39
5
5
  SHA512:
6
- metadata.gz: 1243c2065fb4c6b33e0bba2396ea7306bc08210758ca4b974c25587f0d3bad552431c5c65b95af858385126fd6ddc621db2ee1286f0b16febae8fc4c7694196f
7
- data.tar.gz: '0922d96e1247d446dc4acce1ea37f03229b06d85f213d4e1e8263590aeb6d3bc770c838e39a6b16a3ad404f3e41298fca3ce7560d6ce2e0e24134301e3d92a13'
6
+ metadata.gz: f8f2f6138254768c4d708ca83000cd081bcedcde99e6b497c225c1050059be735c57513194a41f7e130579fb52d18899d818f355a315d642adfc9430b46f4263
7
+ data.tar.gz: 463e56264b0e1dc7f68e039c835432861e706cf60e619947cf60ce8b8e4e28b3cf480e1d6bd7047d2190c08fc7248cadb06cb4c73c518c61eae0028019cbf08e
@@ -7,3 +7,11 @@ require 'arelastic/searches'
7
7
  require 'arelastic/sorts'
8
8
 
9
9
  require 'arelastic/builders'
10
+
11
+ module Arelastic
12
+ class << self
13
+ def queries
14
+ Arelastic::Builders::Queries
15
+ end
16
+ end
17
+ end
@@ -1,6 +1,6 @@
1
1
  require 'arelastic/builders/aggregation'
2
2
  require 'arelastic/builders/filter'
3
3
  require 'arelastic/builders/mapping'
4
- require 'arelastic/builders/query'
4
+ require 'arelastic/builders/queries'
5
5
  require 'arelastic/builders/search'
6
6
  require 'arelastic/builders/sort'
@@ -1,6 +1,6 @@
1
1
  module Arelastic
2
2
  module Builders
3
- class Query < Struct.new :name
3
+ class Queries < Struct.new :name
4
4
  MACROS_TO_ARELASTIC = {
5
5
  bool: Arelastic::Queries::Bool,
6
6
  constant_score: Arelastic::Queries::ConstantScore,
@@ -14,8 +14,8 @@ module Arelastic
14
14
  Arelastic::Builders::Aggregation
15
15
  end
16
16
 
17
- def query
18
- Arelastic::Builders::Query
17
+ def queries
18
+ Arelastic::Builders::Queries
19
19
  end
20
20
 
21
21
  def sort
@@ -1,15 +1,15 @@
1
1
  require 'helper'
2
2
 
3
- class Arelastic::Builders::QueryTest < Minitest::Test
3
+ class Arelastic::Builders::QueriesTest < Minitest::Test
4
4
  def test_constant_score
5
- query = Arelastic::Builders::Query.constant_score({"foo" => "bar"})
5
+ query = Arelastic::Builders::Queries.constant_score({"foo" => "bar"})
6
6
  expected = {"constant_score" => {"foo" => "bar"}}
7
7
 
8
8
  assert_equal expected, query.as_elastic
9
9
  end
10
10
 
11
11
  def test_bool
12
- query = Arelastic::Builders::Query.bool(
12
+ query = Arelastic::Builders::Queries.bool(
13
13
  must: {"query_string" => "foo"},
14
14
  filter: {"term" => "bar"}
15
15
  )
@@ -19,39 +19,39 @@ class Arelastic::Builders::QueryTest < Minitest::Test
19
19
  end
20
20
 
21
21
  def test_match_all
22
- query = Arelastic::Builders::Query.match_all
22
+ query = Arelastic::Builders::Queries.match_all
23
23
  expected = {"match_all" => {}}
24
24
 
25
25
  assert_equal expected, query.as_elastic
26
26
  end
27
27
 
28
28
  def test_multi_match
29
- Arelastic::Builders::Query.multi_match 'blue', ['color', 'description']
29
+ Arelastic::Builders::Queries.multi_match 'blue', ['color', 'description']
30
30
  end
31
31
 
32
32
  def test_field
33
- query = Arelastic::Builders::Query['user'].field 'kimchy'
33
+ query = Arelastic::Builders::Queries['user'].field 'kimchy'
34
34
  expected = { "field" => { "user" => "kimchy" } }
35
35
 
36
36
  assert_equal expected, query.as_elastic
37
37
  end
38
38
 
39
39
  def test_term
40
- query = Arelastic::Builders::Query['user'].term 'kimchy'
40
+ query = Arelastic::Builders::Queries['user'].term 'kimchy'
41
41
  expected = {"term" => { "user" => "kimchy" }}
42
42
 
43
43
  assert_equal expected, query.as_elastic
44
44
  end
45
45
 
46
46
  def test_terms
47
- query = Arelastic::Builders::Query['tags'].terms ['blue', 'pill']
47
+ query = Arelastic::Builders::Queries['tags'].terms ['blue', 'pill']
48
48
  expected = {"terms" => { "tags" => ["blue", "pill"] }}
49
49
 
50
50
  assert_equal expected, query.as_elastic
51
51
  end
52
52
 
53
53
  def test_match
54
- query = Arelastic::Builders::Query['message'].match "hello"
54
+ query = Arelastic::Builders::Queries['message'].match "hello"
55
55
  expected = {"match" => { "message" => "hello" }}
56
56
 
57
57
  assert_equal expected, query.as_elastic
@@ -14,7 +14,7 @@ class Arelastic::Builders::SearchTest < Minitest::Test
14
14
  end
15
15
 
16
16
  def test_query
17
- assert_equal Arelastic::Builders::Query, Arelastic::Builders::Search.query
17
+ assert_equal Arelastic::Builders::Queries, Arelastic::Builders::Search.queries
18
18
  end
19
19
 
20
20
  def test_sort
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class ArelasticTest < Minitest::Test
4
+ def test_queries
5
+ assert_equal Arelastic::Builders::Queries, Arelastic.queries
6
+ end
7
+ 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: 2.5.0
4
+ version: 2.6.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: 2018-11-29 00:00:00.000000000 Z
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Build Elastic Search queries with objects
14
14
  email: developer@matthewhiggins.com
@@ -42,7 +42,7 @@ files:
42
42
  - lib/arelastic/builders/aggregation.rb
43
43
  - lib/arelastic/builders/filter.rb
44
44
  - lib/arelastic/builders/mapping.rb
45
- - lib/arelastic/builders/query.rb
45
+ - lib/arelastic/builders/queries.rb
46
46
  - lib/arelastic/builders/search.rb
47
47
  - lib/arelastic/builders/sort.rb
48
48
  - lib/arelastic/mappings.rb
@@ -117,7 +117,7 @@ files:
117
117
  - test/arelastic/builders/aggregation_test.rb
118
118
  - test/arelastic/builders/filter_test.rb
119
119
  - test/arelastic/builders/mapping_test.rb
120
- - test/arelastic/builders/query_test.rb
120
+ - test/arelastic/builders/queries_test.rb
121
121
  - test/arelastic/builders/search_test.rb
122
122
  - test/arelastic/builders/sort_test.rb
123
123
  - test/arelastic/mappings/types/binary_test.rb
@@ -149,6 +149,7 @@ files:
149
149
  - test/arelastic/searches/sort_test.rb
150
150
  - test/arelastic/sorts/field_test.rb
151
151
  - test/arelastic/sorts/geo_distance_test.rb
152
+ - test/arelastic_test.rb
152
153
  - test/helper.rb
153
154
  homepage: http://github.com/matthuhiggins/arelastic
154
155
  licenses: