dina 1.3.0.0 → 1.3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d466686f44b5d2e0850a05283bef73ccf71bb25da366a1d80aec8945d6e0fd2
|
4
|
+
data.tar.gz: b250f06e97f384449790007f2f4b6588fa634186b7853e4a67508fa049e2ab0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3e4afce48d934ddb4b3ed5f1d4b0fd6c474f38cdb2ef7e7259611a02910f66cd7561d71cb85b858692d0a87e71efa5e5a0b7d005e2ba311a7b76da3f705fcfb
|
7
|
+
data.tar.gz: 7546f5bb55aeb366aed09ed9107a1e6fc26bb2aa7fa7ada784d4d73c2ecb92940803ee97dde61290b10b4313f582ceede57b311840c8d081ac01ebc152366595
|
@@ -4,11 +4,11 @@ require_rel 'search_connection'
|
|
4
4
|
#TODO: requires testing, likely failing
|
5
5
|
|
6
6
|
module Dina
|
7
|
-
class
|
7
|
+
class SearchAutoComplete < BaseModel
|
8
8
|
|
9
9
|
self.connection_class = SearchConnection
|
10
10
|
|
11
|
-
custom_endpoint :execute, on: :collection, request_method: :
|
11
|
+
custom_endpoint :execute, on: :collection, request_method: :get
|
12
12
|
|
13
13
|
def self.endpoint_path
|
14
14
|
"search-api/search-ws/"
|
@@ -34,11 +34,12 @@ module Dina
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def run(request_method, path, params: nil, headers: {}, body: nil)
|
37
|
-
#TODO: works for search class, but likely failing for autocomplete, count, and mapping
|
38
|
-
params = {
|
39
|
-
indexName: index_name(index: body[:index])
|
40
|
-
}
|
41
37
|
path.slice!("/execute")
|
38
|
+
if params && params.has_key?(:index)
|
39
|
+
params.merge!(indexName: index_name(index: params[:index]))
|
40
|
+
elsif body && body.has_key?(:index)
|
41
|
+
params = { indexName: index_name(index: body[:index]) }
|
42
|
+
end
|
42
43
|
payload = JSON.generate(body[:payload]) rescue ""
|
43
44
|
|
44
45
|
response = faraday.run_request(request_method, path, body, headers) do |request|
|
@@ -48,7 +49,16 @@ module Dina
|
|
48
49
|
end
|
49
50
|
|
50
51
|
attributes = response.body.dup
|
51
|
-
|
52
|
+
meta = {}
|
53
|
+
if attributes.has_key?("hits")
|
54
|
+
#TODO: does not work with SearchAutoComplete because response is different from Search
|
55
|
+
meta["count"] = attributes["hits"]["total"]["value"] rescue 0
|
56
|
+
elsif attributes.has_key?("count")
|
57
|
+
meta["count"] = attributes["count"]
|
58
|
+
elsif attributes.has_key?("attributes")
|
59
|
+
meta = attributes
|
60
|
+
end
|
61
|
+
response.body["meta"] = meta
|
52
62
|
response.body["errors"] = []
|
53
63
|
response.body["data"] = attributes["hits"]["hits"].map{|d| d["_source"]["data"]} rescue []
|
54
64
|
response
|
data/lib/dina/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David P. Shorthouse
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-12-
|
12
|
+
date: 2023-12-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_api_client
|