arelastic 2.1.2 → 2.1.3

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
- SHA1:
3
- metadata.gz: d7e7cece5f867bbfe2dedcc985f0f6fec1a930fa
4
- data.tar.gz: 76161f732806f810c4b8b48a197331fec647fb1f
2
+ SHA256:
3
+ metadata.gz: 585b761da2b68ccf4cbca2a5a5a157e657ee3f1c40eced165e37ba516becb71d
4
+ data.tar.gz: f6bb0160c6465adf9b6500c7a74e8a856d996be8e4cc14ea9e22b1d4f5a77f93
5
5
  SHA512:
6
- metadata.gz: '08fef26bfa8760dfff29d33e42926ffa23ea1d3ef978a64668c19047f2482eda7e6ff51f4095e694ade704db5f5f64740e97b07dd227180b1688fd86adceeea7'
7
- data.tar.gz: 99c5b03d1ca49a7e1c7b262fd95cc002b61e1e9ae583f32270dcb8bd4da65f9646e6bca6d8134e1dca692250c703f4e69ff2313e4674ab333994b3229c24fd00
6
+ metadata.gz: a2c2a19e833bc6fe9b31207d0483150292ba35810da42a71f6e840c84f3d3d64f35dc57ab7b111bfacd9a2026bff9b976dfbb1851e5db5744191eb1d64a68fe6
7
+ data.tar.gz: 4143b50ba43d950ff97c433638d4efd9da6015a4d9ca6704de6c22790d1bbe84237f46cd1fc3ca1460739f98fe9bc347b3471064593567c66cb3b6df9a791032
@@ -15,8 +15,10 @@ require 'arelastic/queries/limit'
15
15
  require 'arelastic/queries/match'
16
16
  require 'arelastic/queries/match_all'
17
17
  require 'arelastic/queries/match_none'
18
+ require 'arelastic/queries/match_phrase'
18
19
  require 'arelastic/queries/multi_match'
19
20
  require 'arelastic/queries/nested'
21
+ require 'arelastic/queries/percolate'
20
22
  require 'arelastic/queries/prefix'
21
23
  require 'arelastic/queries/query'
22
24
  require 'arelastic/queries/query_string'
@@ -0,0 +1,7 @@
1
+ module Arelastic
2
+ module Queries
3
+ class MatchPhrase < Arelastic::Queries::Query
4
+ binary 'match_phrase'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,21 @@
1
+ module Arelastic
2
+ module Queries
3
+ class Percolate < Query
4
+ attr_accessor :field, :document, :options
5
+ def initialize(field, document, options = {})
6
+ @field = field
7
+ @document = document
8
+ @options = options
9
+ end
10
+
11
+ def as_elastic
12
+ {
13
+ "percolate" => {
14
+ "field" => field,
15
+ "document" => document
16
+ }.merge(options)
17
+ }
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ require 'helper'
2
+
3
+ class Arelastic::Queries::MatchPhraseTest < Minitest::Test
4
+ def test_as_elastic
5
+ match_phrase = Arelastic::Queries::MatchPhrase.new('message', 'a test')
6
+
7
+ expected = { "match_phrase" => { "message" => "a test" } }
8
+
9
+ assert_equal expected, match_phrase.as_elastic
10
+ end
11
+ end
@@ -0,0 +1,26 @@
1
+ require 'helper'
2
+
3
+ class Arelastic::Queries::PercolateTest < Minitest::Test
4
+ def test_as_elastic
5
+ percolate = Arelastic::Queries::Percolate.new("query", {"color" => "red"})
6
+ expected = {
7
+ "percolate" => {
8
+ "field" => "query",
9
+ "document" => {"color" => "red"}
10
+ }
11
+ }
12
+ assert_equal expected, percolate.as_elastic
13
+ end
14
+
15
+ def test_as_elastic_with_options
16
+ percolate = Arelastic::Queries::Percolate.new("query", {"color" => "red"}, {"document_type" => "widget"})
17
+ expected = {
18
+ "percolate" => {
19
+ "field" => "query",
20
+ "document" => {"color" => "red"},
21
+ "document_type" => "widget"
22
+ }
23
+ }
24
+ assert_equal expected, percolate.as_elastic
25
+ end
26
+ 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.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Higgins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-20 00:00:00.000000000 Z
11
+ date: 2018-01-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Build Elastic Search queries with objects
14
14
  email: developer@matthewhiggins.com
@@ -68,8 +68,10 @@ files:
68
68
  - lib/arelastic/queries/match.rb
69
69
  - lib/arelastic/queries/match_all.rb
70
70
  - lib/arelastic/queries/match_none.rb
71
+ - lib/arelastic/queries/match_phrase.rb
71
72
  - lib/arelastic/queries/multi_match.rb
72
73
  - lib/arelastic/queries/nested.rb
74
+ - lib/arelastic/queries/percolate.rb
73
75
  - lib/arelastic/queries/prefix.rb
74
76
  - lib/arelastic/queries/query.rb
75
77
  - lib/arelastic/queries/query_string.rb
@@ -123,8 +125,10 @@ files:
123
125
  - test/arelastic/queries/ids_test.rb
124
126
  - test/arelastic/queries/match_all_test.rb
125
127
  - test/arelastic/queries/match_none_test.rb
128
+ - test/arelastic/queries/match_phrase_test.rb
126
129
  - test/arelastic/queries/match_test.rb
127
130
  - test/arelastic/queries/multi_match_test.rb
131
+ - test/arelastic/queries/percolate_test.rb
128
132
  - test/arelastic/queries/query_string_test.rb
129
133
  - test/arelastic/queries/query_test.rb
130
134
  - test/arelastic/queries/regexp_test.rb
@@ -156,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
160
  version: 1.8.11
157
161
  requirements: []
158
162
  rubyforge_project:
159
- rubygems_version: 2.6.11
163
+ rubygems_version: 2.7.3
160
164
  signing_key:
161
165
  specification_version: 4
162
166
  summary: Elastic Search query builder