ddr-core 1.4.0 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/ddr/solr_document_behavior.rb +40 -28
- data/lib/ddr/index/connection.rb +0 -2
- data/lib/ddr/index/fields.rb +2 -2
- data/lib/ddr/index/query_result.rb +4 -3
- metadata +8 -10
- data/lib/ddr/core/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d608ea9df0b3941475f6b26cd9f2ca596f435128c12f505a06874c8ac12ba6fc
|
4
|
+
data.tar.gz: ba42e462537f548831cb776a90fd9b8cd8412dbe7920c9a005c4a687587029d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d122b43cddbe62fcc0c0038a82ca90cc4b82b5647366745327177d3dcc58bf610fcf851e50b45fee22d2fc0db0e6800472e4066b9430024c20997f5212d53cad
|
7
|
+
data.tar.gz: 8bfc3f7657b047f710f1d0ca7e63eb5ec0127af33e8ccd8a640201e9716321fc976231640eab5a2bddb8cf8366cb120bdff367eae3b7222a9b21cfd26f02a27b
|
@@ -5,34 +5,41 @@ module Ddr
|
|
5
5
|
module SolrDocumentBehavior
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
|
+
class NotFound < Error; end
|
9
|
+
|
8
10
|
included do
|
9
|
-
|
11
|
+
delegate :query_service,
|
12
|
+
:resource_factory,
|
13
|
+
to: :metadata_adapter
|
10
14
|
end
|
11
15
|
|
12
|
-
class NotFound < Error; end
|
13
|
-
|
14
16
|
module ClassMethods
|
15
17
|
def find(id)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
raise ArgumentError, "ID argument must be present." if id.blank?
|
19
|
+
|
20
|
+
response = Blacklight.default_index.find(id)
|
21
|
+
response.documents.first
|
22
|
+
|
23
|
+
rescue Blacklight::Exceptions::RecordNotFound => e
|
24
|
+
raise NotFound, e
|
21
25
|
end
|
22
26
|
|
23
27
|
def find_by_permanent_id(ark)
|
24
|
-
if ark.blank?
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
return doc
|
28
|
+
raise ArgumentError, "ARK argument must be present." if ark.blank?
|
29
|
+
|
30
|
+
response = Blacklight.default_index.search(q: "#{Ddr::Index::Fields::PERMANENT_ID}:\"#{ark}\"", rows: 1)
|
31
|
+
|
32
|
+
if doc = response.documents.first
|
33
|
+
doc
|
34
|
+
else
|
35
|
+
raise NotFound, "Permanent ID: #{ark}"
|
33
36
|
end
|
34
|
-
raise NotFound, "SolrDocument not found for permanent id \"#{ark}\"."
|
35
37
|
end
|
38
|
+
end # ClassMethods
|
39
|
+
|
40
|
+
def pid
|
41
|
+
warn "DEPRECATION: #pid is deprecated. Use #id instead."
|
42
|
+
id
|
36
43
|
end
|
37
44
|
|
38
45
|
def inspect
|
@@ -56,8 +63,12 @@ module Ddr
|
|
56
63
|
super
|
57
64
|
end
|
58
65
|
|
66
|
+
def metadata_adapter
|
67
|
+
Valkyrie::MetadataAdapter.find(:index_solr)
|
68
|
+
end
|
69
|
+
|
59
70
|
def resource
|
60
|
-
@resource ||=
|
71
|
+
@resource ||= resource_factory.to_resource(object: self)
|
61
72
|
end
|
62
73
|
|
63
74
|
def object_create_date
|
@@ -134,7 +145,7 @@ module Ddr
|
|
134
145
|
end
|
135
146
|
|
136
147
|
def targets_count
|
137
|
-
@targets_count
|
148
|
+
@targets_count ||= targets.count
|
138
149
|
end
|
139
150
|
|
140
151
|
def has_target?
|
@@ -150,7 +161,7 @@ module Ddr
|
|
150
161
|
end
|
151
162
|
|
152
163
|
def roles
|
153
|
-
|
164
|
+
resource.roles
|
154
165
|
end
|
155
166
|
|
156
167
|
def resource_roles
|
@@ -176,9 +187,14 @@ module Ddr
|
|
176
187
|
Ddr::Contact.call(research_help_contact) if research_help_contact
|
177
188
|
end
|
178
189
|
|
179
|
-
|
180
|
-
|
181
|
-
|
190
|
+
#
|
191
|
+
# Fall back to PARENT_ID field, which supersedes IS_PART_OF and _IS_MEMBER_OF_COLLECTION
|
192
|
+
# for this usage.
|
193
|
+
# Cf. https://duldev.atlassian.net/browse/DDR-2296
|
194
|
+
#
|
195
|
+
# def parent_id
|
196
|
+
# is_part_of || is_member_of_collection
|
197
|
+
# end
|
182
198
|
|
183
199
|
def has_parent?
|
184
200
|
parent_id.present?
|
@@ -307,10 +323,6 @@ module Ddr
|
|
307
323
|
|
308
324
|
private
|
309
325
|
|
310
|
-
def query_service
|
311
|
-
@query_service ||= Valkyrie::MetadataAdapter.find(:index_solr).query_service
|
312
|
-
end
|
313
|
-
|
314
326
|
def get_date(field)
|
315
327
|
parse_date(self[field])
|
316
328
|
end
|
data/lib/ddr/index/connection.rb
CHANGED
data/lib/ddr/index/fields.rb
CHANGED
@@ -37,8 +37,8 @@ module Ddr::Index
|
|
37
37
|
DATE_SORT = Field.new :date_sort, :sortable
|
38
38
|
DC_IS_PART_OF = Field.new :isPartOf, :symbol
|
39
39
|
DEPOSITOR = Field.new :depositor, :stored_sortable
|
40
|
-
# DDR-1997 - description should always be indexed as _tesim regardless of length
|
41
|
-
# characters in length as _tsim only
|
40
|
+
# DDR-1997 - description should always be indexed as _tesim regardless of length.
|
41
|
+
# Valkyrie indexes fields > 1000 characters in length as _tsim only.
|
42
42
|
DESCRIPTION = Field.new :description, :stored_searchable # stored_searchable produces _tesim
|
43
43
|
DISPLAY_FORMAT = Field.new :display_format, :stored_sortable
|
44
44
|
DOI = Field.new :doi, :symbol
|
@@ -92,9 +92,10 @@ module Ddr::Index
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def page(num)
|
95
|
-
|
96
|
-
page_size =
|
97
|
-
|
95
|
+
data = params.dup
|
96
|
+
page_size = data.delete(:rows) || PAGE_SIZE
|
97
|
+
opts = { method: :post, data: data }
|
98
|
+
response = Connection.page(num, page_size, 'select', opts)
|
98
99
|
response.docs
|
99
100
|
end
|
100
101
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddr-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Coble
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2021-
|
14
|
+
date: 2021-05-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activeresource
|
@@ -89,14 +89,14 @@ dependencies:
|
|
89
89
|
requirements:
|
90
90
|
- - "~>"
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: 2.1
|
92
|
+
version: '2.1'
|
93
93
|
type: :runtime
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 2.1
|
99
|
+
version: '2.1'
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
101
|
name: grouper-rest-client
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,16 +157,16 @@ dependencies:
|
|
157
157
|
name: omniauth-shibboleth
|
158
158
|
requirement: !ruby/object:Gem::Requirement
|
159
159
|
requirements:
|
160
|
-
- - "
|
160
|
+
- - ">="
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version: '
|
162
|
+
version: '0'
|
163
163
|
type: :runtime
|
164
164
|
prerelease: false
|
165
165
|
version_requirements: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
|
-
- - "
|
167
|
+
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version: '
|
169
|
+
version: '0'
|
170
170
|
- !ruby/object:Gem::Dependency
|
171
171
|
name: virtus
|
172
172
|
requirement: !ruby/object:Gem::Requirement
|
@@ -295,7 +295,6 @@ dependencies:
|
|
295
295
|
version: '0'
|
296
296
|
description: Models used in the Duke Digital Repository
|
297
297
|
email:
|
298
|
-
- lib-drs@duke.edu
|
299
298
|
executables: []
|
300
299
|
extensions: []
|
301
300
|
extra_rdoc_files: []
|
@@ -388,7 +387,6 @@ files:
|
|
388
387
|
- lib/ddr/auth/web_auth_context.rb
|
389
388
|
- lib/ddr/core.rb
|
390
389
|
- lib/ddr/core/engine.rb
|
391
|
-
- lib/ddr/core/version.rb
|
392
390
|
- lib/ddr/error.rb
|
393
391
|
- lib/ddr/files.rb
|
394
392
|
- lib/ddr/fits.rb
|