sequel-elasticsearch 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.dev +1 -0
- data/Rakefile +4 -0
- data/lib/sequel/plugins/elasticsearch/result.rb +27 -0
- data/lib/sequel/plugins/elasticsearch/version.rb +1 -1
- data/lib/sequel/plugins/elasticsearch.rb +2 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b87c9a8747c0bd243d305af4f02882448d70aa520df3796f2873d01a3f541c20
|
4
|
+
data.tar.gz: 60c22bb219e9ff03d2a0d0643e88ee444e13eae054c72bf5d0763b833bfc25ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ef4ffc7a7beb5e2c90a54ec37ab64a5b656880d7ac3246b33772dd26a93339993d2f5fe7df18eff1485c9cae1002477ba7965566e536d1648915e0114d43481
|
7
|
+
data.tar.gz: 23937b2f2d737e0b1eddad6348132604b0a99cd220f2bccb8e29d941effb7e42061d8d46b944d259bb4c6238be7103fd253161b7f18fa25678893715959c758f
|
data/Gemfile.dev
CHANGED
data/Rakefile
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
module Sequel
|
2
|
+
module Plugins
|
3
|
+
module Elasticsearch
|
4
|
+
class Result
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
attr_reader :results, :scroll_id, :total, :took, :timed_out
|
8
|
+
|
9
|
+
def initialize(results)
|
10
|
+
return unless results && results['hits']
|
11
|
+
@results = results
|
12
|
+
@scroll_id = results['_scroll_id']
|
13
|
+
@total = results['hits']['total']
|
14
|
+
@timed_out = results['timed_out']
|
15
|
+
@took = results['took']
|
16
|
+
end
|
17
|
+
|
18
|
+
def each
|
19
|
+
return [] unless results['hits'] && results['hits']['hits']
|
20
|
+
results['hits']['hits'].each { |h| yield h }
|
21
|
+
# TODO: Use the scroll id to get more if needed
|
22
|
+
# We will need access to the client, somehow...
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'elasticsearch'
|
2
|
+
require 'sequel/plugins/elasticsearch/result'
|
2
3
|
|
3
4
|
module Sequel
|
4
5
|
module Plugins
|
@@ -30,7 +31,7 @@ module Sequel
|
|
30
31
|
type: elasticsearch_type
|
31
32
|
}.merge(opts)
|
32
33
|
query.is_a?(String) ? opts[:q] = query : opts[:body] = query
|
33
|
-
es_client.search
|
34
|
+
Result.new es_client.search(opts)
|
34
35
|
end
|
35
36
|
|
36
37
|
def es(query = '', opts = {})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jurgens du Toit
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- README.md
|
141
141
|
- Rakefile
|
142
142
|
- lib/sequel/plugins/elasticsearch.rb
|
143
|
+
- lib/sequel/plugins/elasticsearch/result.rb
|
143
144
|
- lib/sequel/plugins/elasticsearch/version.rb
|
144
145
|
- sequel-elasticsearch.gemspec
|
145
146
|
homepage: https://github.com/jrgns/sequel-elasticsearch
|
@@ -162,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
163
|
version: '0'
|
163
164
|
requirements: []
|
164
165
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.7.
|
166
|
+
rubygems_version: 2.7.5
|
166
167
|
signing_key:
|
167
168
|
specification_version: 4
|
168
169
|
summary: A plugin for the Sequel gem to sync data to Elasticsearch.
|