cul_scv_hydra 0.14.0 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/cul_scv_fedora/dummy_object.rb +2 -2
- data/lib/cul_scv_hydra/engine.rb +2 -2
- data/lib/cul_scv_hydra/indexer.rb +70 -0
- data/lib/cul_scv_hydra/version.rb +1 -1
- data/lib/cul_scv_hydra.rb +1 -0
- data/lib/tasks/cmodel.rake +3 -3
- data/lib/tasks/index.rake +31 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzMzNjljZWE0ZmY3OGNiMjM5ZjU1MzZmMmI0N2E3OWMwODVlYzcxOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzNlYTljNmJjNjE3YjU1ZDAzYzg1NmI3MmZlODVmOWQwOTM3NDU3YQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2NjN2EyNmZmMWQ1YjE1MmQ0ZTJiZDc4MGZhNDc3NDkzNzY1YTI2NGZhNTVk
|
10
|
+
NTBkODBlODhlZWUwMDYxMTVkOWU3MWQ0NWIwNjYwNjZiZjBhZGNjNWUwYjMw
|
11
|
+
NTQ5M2NjNDY5MzQxNzY1NGNhNTQ1ZTk2YzQ3ZDRkODA4ZDA1NzM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmQ2Mjk1NDE2ODUxN2ZlODgyYjNhNDA3Yzc3OWZiMWVkMTlhM2ZmNzlmYmVi
|
14
|
+
MmI3OWY0YWVjMGZmOThjNjEzNGM0YThhMDI3Yzk3ZjA3ODExMDI3ODdiNTQz
|
15
|
+
NjViZWM4OThlOGJkYzIzYThhNDFkZDcxOGQ4MmVlNDI0MTg0MmM=
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Cul
|
2
2
|
module Scv
|
3
3
|
module Fedora
|
4
|
-
class
|
4
|
+
class DummyObject
|
5
5
|
attr_accessor :pid
|
6
6
|
def initialize(pid, isNew=false)
|
7
7
|
@pid = pid
|
@@ -17,7 +17,7 @@ module Cul
|
|
17
17
|
Cul::Scv::Fedora.repository
|
18
18
|
end
|
19
19
|
def spawn(pid)
|
20
|
-
s =
|
20
|
+
s = DummyObject.new(pid)
|
21
21
|
s.connection= connection
|
22
22
|
s.repository= repository
|
23
23
|
s
|
data/lib/cul_scv_hydra/engine.rb
CHANGED
@@ -14,7 +14,7 @@ module Cul::Scv::Hydra
|
|
14
14
|
#{config.root}/app/models/concerns
|
15
15
|
)
|
16
16
|
|
17
|
-
config.generators do |g|
|
17
|
+
config.generators do |g|
|
18
18
|
g.test_framework :rspec
|
19
19
|
g.integration_tool :rspec
|
20
20
|
end
|
@@ -23,7 +23,7 @@ module Cul::Scv::Hydra
|
|
23
23
|
rake_tasks do
|
24
24
|
Dir.chdir(File.expand_path(File.join(File.dirname(__FILE__), '..'))) do
|
25
25
|
Dir.glob(File.join('tasks', '*.rake')).each do |railtie|
|
26
|
-
load railtie
|
26
|
+
#load railtie # Commenting this out for now because we appear to be loading rake tasks twice
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Cul::Scv::Hydra::Indexer
|
2
|
+
|
3
|
+
def self.recursively_index_fedora_objects(pid, skip_top_level_object_indexing=false, verbose_output=false)
|
4
|
+
|
5
|
+
if pid.blank?
|
6
|
+
raise 'Please supply a pid (e.g. rake recursively_index_fedora_objects pid=ldpd:123)'
|
7
|
+
end
|
8
|
+
|
9
|
+
unless ActiveFedora::Base.exists?(pid)
|
10
|
+
raise 'Could not find Fedora object with pid: ' + pid
|
11
|
+
end
|
12
|
+
|
13
|
+
if skip_top_level_object_indexing
|
14
|
+
puts 'Skipping top level object indexing (' + pid + ')' if verbose_output
|
15
|
+
else
|
16
|
+
puts 'Indexing topmost object in this set (' + pid + ')...' if verbose_output
|
17
|
+
puts 'If this is a BagAggregator with a lot of members, this will take a while...' if verbose_output
|
18
|
+
|
19
|
+
# We found an object with the desired PID. Let's reindex it
|
20
|
+
active_fedora_object = ActiveFedora::Base.find(pid, :cast => true)
|
21
|
+
active_fedora_object.update_index
|
22
|
+
|
23
|
+
puts 'Done indexing topmost object (' + pid + '). Took ' + (Time.now - START_TIME).to_s + ' seconds' if verbose_output
|
24
|
+
end
|
25
|
+
|
26
|
+
puts 'Recursively retreieving and indexing all members...'
|
27
|
+
|
28
|
+
member_query =
|
29
|
+
'select $child $parent $cmodel from <#ri>
|
30
|
+
where
|
31
|
+
walk($child <http://purl.oclc.org/NET/CUL/memberOf> <fedora:' + pid + '> and $child <http://purl.oclc.org/NET/CUL/memberOf> $parent)
|
32
|
+
and
|
33
|
+
$child <fedora-model:hasModel> $cmodel'
|
34
|
+
|
35
|
+
puts 'Performing query:' if verbose_output
|
36
|
+
puts member_query if verbose_output
|
37
|
+
|
38
|
+
search_response = JSON(Cul::Scv::Fedora.repository.find_by_itql(member_query, {
|
39
|
+
:type => 'tuples',
|
40
|
+
:format => 'json',
|
41
|
+
:limit => '',
|
42
|
+
:stream => 'on'
|
43
|
+
}))
|
44
|
+
|
45
|
+
unique_pids = search_response['results'].map{|result| result['child'].gsub('info:fedora/', '') }.uniq
|
46
|
+
|
47
|
+
total_number_of_members = unique_pids.length
|
48
|
+
puts 'Recursive search found ' + total_number_of_members.to_s + ' members.' if verbose_output
|
49
|
+
|
50
|
+
i = 1
|
51
|
+
if total_number_of_members > 0
|
52
|
+
unique_pids.each {|pid|
|
53
|
+
|
54
|
+
print 'Indexing ' + i.to_s + ' of ' + total_number_of_members.to_s + ' members (' + pid + ')...' if verbose_output
|
55
|
+
|
56
|
+
active_fedora_object = ActiveFedora::Base.find(pid, :cast => true)
|
57
|
+
active_fedora_object.update_index
|
58
|
+
|
59
|
+
# Display progress
|
60
|
+
puts 'done.' if verbose_output
|
61
|
+
|
62
|
+
i += 1
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
puts 'Indexing complete! Took ' + (Time.now - START_TIME).to_s + ' seconds' if verbose_output
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
data/lib/cul_scv_hydra.rb
CHANGED
@@ -39,6 +39,7 @@ end
|
|
39
39
|
require "cul_scv_hydra/access_controls_enforcement"
|
40
40
|
require "cul_scv_hydra/controllers"
|
41
41
|
require "cul_scv_hydra/om"
|
42
|
+
require "cul_scv_hydra/indexer"
|
42
43
|
require "cul_scv_hydra/solrizer"
|
43
44
|
require "cul_scv_hydra/version"
|
44
45
|
require "cul_scv_hydra/engine" if defined? Rails
|
data/lib/tasks/cmodel.rake
CHANGED
@@ -58,7 +58,7 @@ end
|
|
58
58
|
def load_content(content, pid)
|
59
59
|
begin
|
60
60
|
connection.ingest(:file=>StringIO.new(content), :pid=>pid)
|
61
|
-
rescue Exception => e
|
61
|
+
rescue Exception => e
|
62
62
|
puts "possible problem with ingest of #{pid}: #{e.message}"
|
63
63
|
raise e
|
64
64
|
end
|
@@ -67,7 +67,7 @@ end
|
|
67
67
|
def purge(pid)
|
68
68
|
begin
|
69
69
|
connection.purge_object :pid=>pid
|
70
|
-
rescue Exception => e
|
70
|
+
rescue Exception => e
|
71
71
|
puts "possible problem with purge of #{pid}: #{e.message}"
|
72
72
|
end
|
73
73
|
|
@@ -78,7 +78,7 @@ def reload(pid)
|
|
78
78
|
purge(pid)
|
79
79
|
load_content(fcontent, pid)
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
|
83
83
|
namespace :cul_scv_hydra do
|
84
84
|
namespace :cmodel do
|
@@ -0,0 +1,31 @@
|
|
1
|
+
namespace :cul_scv_hydra do
|
2
|
+
|
3
|
+
namespace :index do
|
4
|
+
|
5
|
+
task :recursively_index_fedora_objects => :environment do
|
6
|
+
|
7
|
+
puts '---------------------------'
|
8
|
+
puts 'Fedora URL: ' + ActiveFedora.config.credentials[:url]
|
9
|
+
puts 'Solr URL: ' + ActiveFedora.solr_config[:url]
|
10
|
+
puts '---------------------------'
|
11
|
+
|
12
|
+
START_TIME = Time.now
|
13
|
+
|
14
|
+
#lindquist == burke_lindq == ldpd:130509
|
15
|
+
|
16
|
+
ENV["RAILS_ENV"] ||= Rails.env
|
17
|
+
pid = ENV['pid']
|
18
|
+
skip_top_level_object_indexing = ( ! ENV['skip_top_level_object_indexing'].blank? && ENV['skip_top_level_object_indexing'])
|
19
|
+
|
20
|
+
begin
|
21
|
+
Cul::Scv::Hydra::Indexer.recursively_index_fedora_objects(pid, skip_top_level_object_indexing, true)
|
22
|
+
rescue => e
|
23
|
+
puts e
|
24
|
+
next
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cul_scv_hydra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Armintor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: blacklight
|
@@ -266,6 +266,7 @@ files:
|
|
266
266
|
- lib/cul_scv_hydra/controllers/suggestions.rb
|
267
267
|
- lib/cul_scv_hydra/controllers/terms.rb
|
268
268
|
- lib/cul_scv_hydra/engine.rb
|
269
|
+
- lib/cul_scv_hydra/indexer.rb
|
269
270
|
- lib/cul_scv_hydra/om.rb
|
270
271
|
- lib/cul_scv_hydra/om/standard_mods.rb
|
271
272
|
- lib/cul_scv_hydra/solrizer.rb
|
@@ -276,6 +277,7 @@ files:
|
|
276
277
|
- lib/cul_scv_hydra/solrizer/value_mapper.rb
|
277
278
|
- lib/cul_scv_hydra/version.rb
|
278
279
|
- lib/tasks/cmodel.rake
|
280
|
+
- lib/tasks/index.rake
|
279
281
|
homepage: https://github.com/cul/cul_scv_hydra
|
280
282
|
licenses: []
|
281
283
|
metadata: {}
|