dor-services 6.7.0 → 6.8.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85d61e2ff2890b4d25489c7dd7ecdd696d29b6dc1fc71939045cdb5ce801d914
|
4
|
+
data.tar.gz: 27b4b9d65371523af32aa306670d783e8da0abc9f04e44d3a001ad99ba2b7f6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f44b068a8964f6873fd493d3ef274cc98dd8faa9ba619ade56197892d3783a82ab83a9dae62edfd3cc5c7ef6c183f37ae8ed012ad2544941d31e51498d7e260d
|
7
|
+
data.tar.gz: cf2d94e214f0d002d64d01003cb52e8952167fa310c641f3809a4bcc8dd7235924d6461ca7cb42644b8c7e12c5f95a36c215ba69e1839f6703d555692e0ba9df
|
data/lib/dor-services.rb
CHANGED
@@ -22,16 +22,16 @@ module Dor
|
|
22
22
|
# index is missing the objectType property.
|
23
23
|
# @param [String] pid The object's PID
|
24
24
|
def load_instance(pid)
|
25
|
-
|
25
|
+
Deprecation.warn(self, 'load_instance is deprecated, use Dor.find instead')
|
26
|
+
find(pid)
|
26
27
|
end
|
27
28
|
|
28
|
-
#
|
29
|
-
#
|
30
|
-
# Dor.load_instance() if the item is not in the index, or is improperly indexed.
|
29
|
+
# Load an object and inspect its identityMetadata to figure out what class
|
30
|
+
# to adapt it to.
|
31
31
|
# @param [String] pid The object's PID
|
32
32
|
# @return [Object] the ActiveFedora-modeled object
|
33
33
|
def find(pid, _opts = {})
|
34
|
-
|
34
|
+
Dor::Abstract.find pid, cast: true
|
35
35
|
end
|
36
36
|
|
37
37
|
# TODO: return enumerable and lazy load_instance
|
@@ -4,6 +4,8 @@ require 'benchmark'
|
|
4
4
|
|
5
5
|
module Dor
|
6
6
|
class IndexingService
|
7
|
+
extend Deprecation
|
8
|
+
|
7
9
|
class ReindexError < RuntimeError; end
|
8
10
|
|
9
11
|
##
|
@@ -11,6 +13,7 @@ module Dor
|
|
11
13
|
# @yield attempt to execute 'entry_id_block' and use the result as an extra identifier for the log
|
12
14
|
# entry. a placeholder will be used otherwise. 'request.uuid' might be useful in a Rails app.
|
13
15
|
def self.generate_index_logger(&entry_id_block)
|
16
|
+
Deprecation.warn(self, 'generate_index_logger is deprecated and will be removed in dor-services version 7')
|
14
17
|
index_logger = Logger.new(Config.indexing_svc.log, Config.indexing_svc.log_rotation_interval)
|
15
18
|
index_logger.formatter = proc do |_severity, datetime, _progname, msg|
|
16
19
|
date_format_str = Config.indexing_svc.log_date_format_str
|
@@ -28,11 +31,13 @@ module Dor
|
|
28
31
|
@@loggers = { default: nil }
|
29
32
|
|
30
33
|
def self.default_index_logger
|
34
|
+
Deprecation.warn(self, 'default_index_logger is deprecated and will be removed in dor-services version 7')
|
31
35
|
@@loggers[:default] ||= generate_index_logger
|
32
36
|
end
|
33
37
|
|
34
38
|
# takes a Dor object and indexes it to solr. doesn't commit automatically.
|
35
39
|
def self.reindex_object(obj, options = {})
|
40
|
+
Deprecation.warn(self, 'reindex_pid is deprecated and will be removed in dor-services 7.')
|
36
41
|
solr_doc = obj.to_solr
|
37
42
|
Dor::SearchService.solr.add(solr_doc, options)
|
38
43
|
solr_doc
|
@@ -42,6 +47,8 @@ module Dor
|
|
42
47
|
# @param [String] pid the druid
|
43
48
|
# @raise [ReindexError] on failure
|
44
49
|
def self.reindex_pid_remotely(pid)
|
50
|
+
Deprecation.warn(self, 'reindex_pid_remotely is deprecated and will be removed in dor-services 7.')
|
51
|
+
|
45
52
|
pid = "druid:#{pid}" unless pid =~ /^druid:/
|
46
53
|
realtime = Benchmark.realtime do
|
47
54
|
with_retries(max_tries: 3, rescue: [RestClient::Exception, Errno::ECONNREFUSED]) do
|
@@ -72,6 +79,7 @@ module Dor
|
|
72
79
|
# @overload reindex_pid(pid, index_logger, should_raise_errors, options = {})
|
73
80
|
# @overload reindex_pid(pid, options = {})
|
74
81
|
def self.reindex_pid(pid, *args)
|
82
|
+
Deprecation.warn(self, 'reindex_pid is deprecated and will be removed in dor-services 7.')
|
75
83
|
options = {}
|
76
84
|
options = args.pop if args.last.is_a? Hash
|
77
85
|
|
@@ -89,8 +97,8 @@ module Dor
|
|
89
97
|
solr_doc = nil
|
90
98
|
|
91
99
|
# benchmark how long it takes to load the object
|
92
|
-
load_stats = Benchmark.measure('
|
93
|
-
obj = Dor.
|
100
|
+
load_stats = Benchmark.measure('find') do
|
101
|
+
obj = Dor.find pid
|
94
102
|
end.format('%n realtime %rs total CPU %ts').gsub(/[\(\)]/, '')
|
95
103
|
|
96
104
|
# benchmark how long it takes to convert the object to a Solr document
|
@@ -115,6 +123,7 @@ module Dor
|
|
115
123
|
|
116
124
|
# given a list of pids, retrieve those objects from fedora, index each to solr, optionally commit
|
117
125
|
def self.reindex_pid_list(pid_list, should_commit = false)
|
126
|
+
Deprecation.warn(self, 'reindex_pid_list is deprecated and will be removed in dor-services 7')
|
118
127
|
pid_list.each { |pid| reindex_pid pid, raise_errors: false } # use the default logger, don't let individual errors nuke the rest of the batch
|
119
128
|
ActiveFedora.solr.conn.commit if should_commit
|
120
129
|
end
|
@@ -2,24 +2,26 @@
|
|
2
2
|
|
3
3
|
require 'rest-client'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
module Dor
|
6
|
+
class CatalogHandler
|
7
|
+
def fetch(prefix, identifier)
|
8
|
+
client = RestClient::Resource.new(Dor::Config.metadata.catalog.url,
|
9
|
+
Dor::Config.metadata.catalog.user,
|
10
|
+
Dor::Config.metadata.catalog.pass)
|
11
|
+
params = "?#{prefix.chomp}=#{identifier.chomp}"
|
12
|
+
client[params].get
|
13
|
+
rescue RestClient::Exception => e
|
14
|
+
raise BadResponseFromCatalog, "#{e.class} - when contacting (with BasicAuth hidden): #{Dor::Config.metadata.catalog.url}#{params}"
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
def label(metadata)
|
18
|
+
mods = Nokogiri::XML(metadata)
|
19
|
+
mods.root.add_namespace_definition('mods', 'http://www.loc.gov/mods/v3')
|
20
|
+
mods.xpath('/mods:mods/mods:titleInfo[1]').xpath('mods:title|mods:nonSort').collect(&:text).join(' ').strip
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
23
|
+
def prefixes
|
24
|
+
%w(catkey barcode)
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
@@ -5,6 +5,7 @@ require 'active_support/core_ext'
|
|
5
5
|
|
6
6
|
module Dor
|
7
7
|
class SearchService
|
8
|
+
extend Deprecation
|
8
9
|
RISEARCH_TEMPLATE = "select $object from <#ri> where $object <dc:identifier> '%s'"
|
9
10
|
@@index_version = nil
|
10
11
|
|
@@ -13,7 +14,9 @@ module Dor
|
|
13
14
|
Dor::VERSION
|
14
15
|
end
|
15
16
|
|
17
|
+
# @deprecated because this depends on Fedora 3 having sparql turned on
|
16
18
|
def risearch(query, opts = {})
|
19
|
+
Deprecation.warn(self, 'risearch is deprecated and will be removed in dor-services 7')
|
17
20
|
client = Config.fedora.client['risearch']
|
18
21
|
client.options[:timeout] = opts.delete(:timeout)
|
19
22
|
query_params = {
|
@@ -28,7 +31,9 @@ module Dor
|
|
28
31
|
result.split(/\n/)[1..-1].collect { |pid| pid.chomp.sub(/^info:fedora\//, '') }
|
29
32
|
end
|
30
33
|
|
34
|
+
# @deprecated because this depends on Fedora 3 having sparql turned on
|
31
35
|
def iterate_over_pids(opts = {})
|
36
|
+
Deprecation.warn(self, 'iterate_over_pids is deprecated and will be removed in dor-services 7')
|
32
37
|
opts[:query] ||= 'select $object from <#ri> where $object <info:fedora/fedora-system:def/model#label> $label'
|
33
38
|
opts[:in_groups_of] ||= 100
|
34
39
|
opts[:mode] ||= :single
|
data/lib/dor/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Klein
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2019-04-
|
17
|
+
date: 2019-04-11 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: active-fedora
|