spotlight-dor-resources 0.0.1
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 +7 -0
- data/.gitignore +23 -0
- data/.hound.yml +2 -0
- data/.rubocop.yml +8 -0
- data/.rubocop_todo.yml +191 -0
- data/.travis.yml +17 -0
- data/Gemfile +32 -0
- data/LICENSE.txt +13 -0
- data/README.md +65 -0
- data/Rakefile +48 -0
- data/app/models/spotlight/resources/dor_resource.rb +17 -0
- data/app/models/spotlight/resources/harvestdor.rb +4 -0
- data/app/models/spotlight/resources/purl.rb +14 -0
- data/app/models/spotlight/resources/searchworks.rb +15 -0
- data/lib/spotlight/dor/indexer.rb +160 -0
- data/lib/spotlight/dor/resources.rb +16 -0
- data/lib/spotlight/dor/resources/engine.rb +13 -0
- data/lib/spotlight/dor/resources/version.rb +7 -0
- data/solr_conf/conf/schema.xml +346 -0
- data/solr_conf/conf/solrconfig.xml +180 -0
- data/spec/integration/gdor_integration_spec.rb +30 -0
- data/spec/integration/indexer_integration_spec.rb +28 -0
- data/spec/models/spotlight/resources/purl_spec.rb +115 -0
- data/spec/models/spotlight/resources/searchworks_spec.rb +91 -0
- data/spec/spec_helper.rb +60 -0
- data/spec/test_app_templates/catalog_controller.rb +96 -0
- data/spec/test_app_templates/gdor.yml +9 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +40 -0
- data/spec/unit/spotlight/dor/indexer_spec.rb +200 -0
- data/spec/vcr_cassettes/gdor_indexing_integration_test/should_have_a_doc_id.yml +1201 -0
- data/spec/vcr_cassettes/gdor_indexing_integration_test/should_have_exhibit-specific_indexing.yml +1003 -0
- data/spec/vcr_cassettes/gdor_indexing_integration_test/should_have_spotlight_data.yml +1003 -0
- data/spec/vcr_cassettes/gdor_indexing_integration_test/should_have_the_gdor_data.yml +1003 -0
- data/spec/vcr_cassettes/indexer_integration_tests/donor_tags/no_donor_tags_ssim_field_in_solr_doc_when_note_displayLabel_Donor_tags_not_in_MODS.yml +1382 -0
- data/spec/vcr_cassettes/indexer_integration_tests/donor_tags/solr_doc_has_donor_tags_ssim_field_when_note_displayLabel_Donor_tags_is_in_MODS.yml +1602 -0
- data/spec/vcr_cassettes/indexer_integration_tests/genre/no_genre_ssim_field_when_genre_not_in_MODS.yml +6822 -0
- data/spec/vcr_cassettes/indexer_integration_tests/genre/solr_doc_has_genre_ssim_field_when_genre_in_MODS.yml +1390 -0
- data/spotlight-dor-resources.gemspec +37 -0
- metadata +336 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b86fa8d9250353055a9f68632944a996fa4e0523
|
4
|
+
data.tar.gz: d53448b9b23303463ed7db3c54d7f02bff763739
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7df884fe6f4617270b56b97dccb83630f6cae9ac2640c6a28d4a7763c702ae1e3b77f4ca300647b952b185fefd577096742ceedd4e17f584b34ffee1068ec676
|
7
|
+
data.tar.gz: a9757073e8b1e7a92df0e2cc39d00ba8df3d028aed15c9f776a907c0b546b19405b08a46535742bd09700819f1e8480c673443ad59e0589912c6ce70beb07608
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.rbc
|
2
|
+
*.sassc
|
3
|
+
.sass-cache
|
4
|
+
capybara-*.html
|
5
|
+
.rspec
|
6
|
+
.rvmrc
|
7
|
+
.ruby-version
|
8
|
+
/.bundle
|
9
|
+
/vendor/bundle
|
10
|
+
/log/*
|
11
|
+
/tmp/*
|
12
|
+
/db/*.sqlite3
|
13
|
+
/public/system/*
|
14
|
+
/coverage/
|
15
|
+
/spec/tmp/*
|
16
|
+
**.orig
|
17
|
+
rerun.txt
|
18
|
+
pickle-email-*.html
|
19
|
+
.project
|
20
|
+
config/initializers/secret_token.rb
|
21
|
+
spec/internal
|
22
|
+
Gemfile.lock
|
23
|
+
jetty
|
data/.hound.yml
ADDED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2015-10-29 09:20:45 -0700 using RuboCop version 0.34.2.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 2
|
10
|
+
Metrics/AbcSize:
|
11
|
+
Max: 33
|
12
|
+
|
13
|
+
# Offense count: 1
|
14
|
+
# Configuration parameters: CountComments.
|
15
|
+
Metrics/ClassLength:
|
16
|
+
Max: 102
|
17
|
+
|
18
|
+
# Offense count: 84
|
19
|
+
# Configuration parameters: AllowURI, URISchemes.
|
20
|
+
Metrics/LineLength:
|
21
|
+
Max: 171
|
22
|
+
|
23
|
+
# Offense count: 1
|
24
|
+
# Configuration parameters: CountComments.
|
25
|
+
Metrics/MethodLength:
|
26
|
+
Max: 13
|
27
|
+
|
28
|
+
# Offense count: 1
|
29
|
+
# Cop supports --auto-correct.
|
30
|
+
Performance/StringReplacement:
|
31
|
+
Exclude:
|
32
|
+
- 'lib/spotlight/dor/indexer.rb'
|
33
|
+
|
34
|
+
# Offense count: 2
|
35
|
+
RSpec/DescribeClass:
|
36
|
+
Exclude:
|
37
|
+
- 'spec/integration/gdor_integration_spec.rb'
|
38
|
+
- 'spec/integration/indexer_integration_spec.rb'
|
39
|
+
|
40
|
+
# Offense count: 4
|
41
|
+
RSpec/DescribedClass:
|
42
|
+
Exclude:
|
43
|
+
- 'spec/models/spotlight/resources/purl_spec.rb'
|
44
|
+
- 'spec/models/spotlight/resources/searchworks_spec.rb'
|
45
|
+
|
46
|
+
# Offense count: 26
|
47
|
+
# Configuration parameters: CustomTransform, IgnoredWords.
|
48
|
+
RSpec/ExampleWording:
|
49
|
+
Exclude:
|
50
|
+
- 'spec/integration/gdor_integration_spec.rb'
|
51
|
+
- 'spec/models/spotlight/resources/purl_spec.rb'
|
52
|
+
- 'spec/models/spotlight/resources/searchworks_spec.rb'
|
53
|
+
|
54
|
+
# Offense count: 4
|
55
|
+
# Cop supports --auto-correct.
|
56
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
57
|
+
Style/AndOr:
|
58
|
+
Exclude:
|
59
|
+
- 'lib/spotlight/dor/indexer.rb'
|
60
|
+
- 'spec/spec_helper.rb'
|
61
|
+
|
62
|
+
# Offense count: 11
|
63
|
+
# Cop supports --auto-correct.
|
64
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
65
|
+
Style/BracesAroundHashParameters:
|
66
|
+
Exclude:
|
67
|
+
- 'spec/models/spotlight/resources/purl_spec.rb'
|
68
|
+
- 'spec/models/spotlight/resources/searchworks_spec.rb'
|
69
|
+
|
70
|
+
# Offense count: 6
|
71
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
72
|
+
Style/ClassAndModuleChildren:
|
73
|
+
Exclude:
|
74
|
+
- 'app/models/spotlight/resources/dor_resource.rb'
|
75
|
+
- 'app/models/spotlight/resources/harvestdor.rb'
|
76
|
+
- 'app/models/spotlight/resources/purl.rb'
|
77
|
+
- 'app/models/spotlight/resources/searchworks.rb'
|
78
|
+
- 'lib/spotlight/dor/indexer.rb'
|
79
|
+
- 'lib/spotlight/dor/resources/engine.rb'
|
80
|
+
|
81
|
+
# Offense count: 7
|
82
|
+
# Configuration parameters: Exclude.
|
83
|
+
Style/Documentation:
|
84
|
+
Exclude:
|
85
|
+
- 'app/models/spotlight/resources/dor_resource.rb'
|
86
|
+
- 'app/models/spotlight/resources/purl.rb'
|
87
|
+
- 'app/models/spotlight/resources/searchworks.rb'
|
88
|
+
- 'lib/spotlight/dor/indexer.rb'
|
89
|
+
- 'lib/spotlight/dor/resources.rb'
|
90
|
+
- 'lib/spotlight/dor/resources/engine.rb'
|
91
|
+
- 'lib/spotlight/dor/resources/version.rb'
|
92
|
+
|
93
|
+
# Offense count: 2
|
94
|
+
Style/DoubleNegation:
|
95
|
+
Exclude:
|
96
|
+
- 'app/models/spotlight/resources/purl.rb'
|
97
|
+
- 'app/models/spotlight/resources/searchworks.rb'
|
98
|
+
|
99
|
+
# Offense count: 1
|
100
|
+
# Cop supports --auto-correct.
|
101
|
+
Style/EmptyLines:
|
102
|
+
Exclude:
|
103
|
+
- 'spec/spec_helper.rb'
|
104
|
+
|
105
|
+
# Offense count: 4
|
106
|
+
# Cop supports --auto-correct.
|
107
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
108
|
+
Style/EmptyLinesAroundClassBody:
|
109
|
+
Exclude:
|
110
|
+
- 'app/models/spotlight/resources/purl.rb'
|
111
|
+
- 'app/models/spotlight/resources/searchworks.rb'
|
112
|
+
- 'lib/spotlight/dor/resources/engine.rb'
|
113
|
+
|
114
|
+
# Offense count: 1
|
115
|
+
# Cop supports --auto-correct.
|
116
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
117
|
+
Style/EmptyLinesAroundModuleBody:
|
118
|
+
Exclude:
|
119
|
+
- 'lib/spotlight/dor/resources.rb'
|
120
|
+
|
121
|
+
# Offense count: 9
|
122
|
+
# Cop supports --auto-correct.
|
123
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
124
|
+
Style/MethodDefParentheses:
|
125
|
+
Enabled: false
|
126
|
+
|
127
|
+
# Offense count: 4
|
128
|
+
# Cop supports --auto-correct.
|
129
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
|
130
|
+
Style/RegexpLiteral:
|
131
|
+
Exclude:
|
132
|
+
- 'app/models/spotlight/resources/purl.rb'
|
133
|
+
- 'app/models/spotlight/resources/searchworks.rb'
|
134
|
+
|
135
|
+
# Offense count: 2
|
136
|
+
# Cop supports --auto-correct.
|
137
|
+
Style/SpaceAfterComma:
|
138
|
+
Exclude:
|
139
|
+
- 'lib/spotlight/dor/indexer.rb'
|
140
|
+
|
141
|
+
# Offense count: 2
|
142
|
+
# Cop supports --auto-correct.
|
143
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
144
|
+
Style/SpaceInsideBlockBraces:
|
145
|
+
Enabled: false
|
146
|
+
|
147
|
+
# Offense count: 31
|
148
|
+
# Cop supports --auto-correct.
|
149
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
|
150
|
+
Style/SpaceInsideHashLiteralBraces:
|
151
|
+
Enabled: false
|
152
|
+
|
153
|
+
# Offense count: 122
|
154
|
+
# Cop supports --auto-correct.
|
155
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
156
|
+
Style/StringLiterals:
|
157
|
+
Enabled: false
|
158
|
+
|
159
|
+
# Offense count: 1
|
160
|
+
# Cop supports --auto-correct.
|
161
|
+
# Configuration parameters: IgnoredMethods.
|
162
|
+
Style/SymbolProc:
|
163
|
+
Exclude:
|
164
|
+
- 'lib/spotlight/dor/indexer.rb'
|
165
|
+
|
166
|
+
# Offense count: 2
|
167
|
+
# Cop supports --auto-correct.
|
168
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
169
|
+
Style/TrailingBlankLines:
|
170
|
+
Exclude:
|
171
|
+
- 'spec/models/spotlight/resources/searchworks_spec.rb'
|
172
|
+
- 'spec/spec_helper.rb'
|
173
|
+
|
174
|
+
# Offense count: 12
|
175
|
+
# Cop supports --auto-correct.
|
176
|
+
Style/TrailingWhitespace:
|
177
|
+
Exclude:
|
178
|
+
- 'lib/spotlight/dor/resources.rb'
|
179
|
+
- 'spec/models/spotlight/resources/searchworks_spec.rb'
|
180
|
+
|
181
|
+
# Offense count: 1
|
182
|
+
# Cop supports --auto-correct.
|
183
|
+
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, Whitelist.
|
184
|
+
Style/TrivialAccessors:
|
185
|
+
Exclude:
|
186
|
+
- 'lib/spotlight/dor/indexer.rb'
|
187
|
+
|
188
|
+
# Offense count: 4
|
189
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
190
|
+
Style/VariableName:
|
191
|
+
Enabled: false
|
data/.travis.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
notifications:
|
2
|
+
email: false
|
3
|
+
|
4
|
+
rvm:
|
5
|
+
- 2.2.2
|
6
|
+
|
7
|
+
env:
|
8
|
+
global:
|
9
|
+
- JRUBY_OPTS="-J-Xms512m -J-Xmx1024m"
|
10
|
+
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
11
|
+
|
12
|
+
sudo: false
|
13
|
+
language: ruby
|
14
|
+
|
15
|
+
script:
|
16
|
+
- bundle exec rake
|
17
|
+
- bundle exec rake rubocop
|
data/Gemfile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in spotlight-dor-resources.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :test do
|
7
|
+
gem 'simplecov', '~> 0.10', require: false
|
8
|
+
gem 'coveralls', require: false
|
9
|
+
gem 'rubocop', require: false
|
10
|
+
gem 'rubocop-rspec', require: false
|
11
|
+
gem 'pry', require: false
|
12
|
+
gem 'pry-byebug', require: false
|
13
|
+
end
|
14
|
+
|
15
|
+
# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app
|
16
|
+
file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path("../spec/internal", __FILE__))
|
17
|
+
if File.exist?(file)
|
18
|
+
puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
|
19
|
+
instance_eval File.read(file)
|
20
|
+
else
|
21
|
+
gem 'rails', ENV['RAILS_VERSION']
|
22
|
+
|
23
|
+
# explicitly include sass-rails to get compatible sprocket dependencies
|
24
|
+
if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^4.2/
|
25
|
+
gem 'coffee-rails', '~> 4.1.0'
|
26
|
+
gem 'sass-rails', '~> 5.0'
|
27
|
+
gem 'responders', "~> 2.0"
|
28
|
+
else
|
29
|
+
gem 'sass-rails', "< 5.0"
|
30
|
+
gem 'coffee-rails', "~> 4.0.0"
|
31
|
+
end
|
32
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2014 The Board of Trustees of the Leland Stanford Junior University.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
[](https://travis-ci.org/sul-dlss/spotlight-dor-resources) | [](https://coveralls.io/r/sul-dlss/spotlight-dor-resources) | [](http://badge.fury.io/rb/spotlight-dor-resources)
|
2
|
+
|
3
|
+
# Spotlight::Dor::Resources
|
4
|
+
|
5
|
+
Harvest Stanford DOR resources into a Spotlight exhibit.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'spotlight-dor-resources'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install spotlight-dor-resources
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Within a Spotlight application with `spotlight-dor-resources` installed, you could index a set of records the ["gdor-indexer"](https://github.com/sul-dlss/gdor-indexer) way.
|
24
|
+
|
25
|
+
Note that Spotlight:
|
26
|
+
|
27
|
+
* is a Rails engine and needs to be used in the context of a Rails application. We use [engine_cart](https://github.com/cbeer/engine_cart) to create an internal test application at spec/internal.
|
28
|
+
* uses Solr as part of its integration tests. We use [jettywrapper](https://github.com/projecthydra/jettywrapper) to manage the Solr instance used for development and test.
|
29
|
+
|
30
|
+
Our `$ rake ci` task utilizes Solr and the testing rails app, with Spotlight installed, automatically.
|
31
|
+
|
32
|
+
For access to a Rails console with the gem loaded up for testing purposes, you can use an engine-cart generated Spotlight app.
|
33
|
+
|
34
|
+
### First time only configuration for local testing
|
35
|
+
|
36
|
+
$ bundle
|
37
|
+
$ bundle exec rake:ci
|
38
|
+
|
39
|
+
This will download a test jetty instance (to run Solr), generate a testing app at ```spec/internal``` and run the tests.
|
40
|
+
|
41
|
+
### Indexing with the generated test app
|
42
|
+
|
43
|
+
$ cd spec/internal
|
44
|
+
|
45
|
+
$ bundle exec rails console
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
purl=Spotlight::Resources::Purl.new({:url=>'https://purl.stanford.edu/cx709ty7769'})
|
49
|
+
puts purl.to_solr.first # the solr document as a hash
|
50
|
+
public_xml=purl.resource.public_xml # nokogiri doc with all public XML
|
51
|
+
mods=purl.resource.mods # nokogiri doc with just the MODs
|
52
|
+
smods_rec=purl.resource.smods_rec # a Stanford::Mods::Record Object (which inherits from the MODS gem)
|
53
|
+
|
54
|
+
purl.resource.indexer.config.solr.url # the configured solr server (should be localhost in development)
|
55
|
+
purl.save # save and index to solr
|
56
|
+
purl.reindex # reindex once saved the first time
|
57
|
+
```
|
58
|
+
|
59
|
+
## Contributing
|
60
|
+
|
61
|
+
1. Fork it ( http://github.com/sul-dlss/spotlight-dor-resources/fork )
|
62
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
63
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
64
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
65
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
ZIP_URL = 'https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.4.zip'
|
8
|
+
|
9
|
+
Bundler::GemHelper.install_tasks
|
10
|
+
|
11
|
+
task default: [:ci, :rubocop]
|
12
|
+
|
13
|
+
namespace :spotlight do
|
14
|
+
desc 'Copies the default SOLR config for the bundled Testing Server'
|
15
|
+
task :configure_jetty do
|
16
|
+
FileList['solr_conf/conf/*'].each do |f|
|
17
|
+
cp("#{f}", 'jetty/solr/blacklight-core/conf/', verbose: true)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'rspec/core/rake_task'
|
23
|
+
RSpec::Core::RakeTask.new(:spec)
|
24
|
+
|
25
|
+
require 'rubocop/rake_task'
|
26
|
+
RuboCop::RakeTask.new(:rubocop)
|
27
|
+
|
28
|
+
require 'jettywrapper'
|
29
|
+
require 'engine_cart/rake_task'
|
30
|
+
task ci: ['engine_cart:generate', 'jetty:clean', 'spotlight:configure_jetty'] do
|
31
|
+
ENV['environment'] = 'test'
|
32
|
+
jetty_params = Jettywrapper.load_config
|
33
|
+
jetty_params[:startup_wait] = 60
|
34
|
+
|
35
|
+
Jettywrapper.wrap(jetty_params) do
|
36
|
+
# run the tests
|
37
|
+
Rake::Task['spec'].invoke
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
require 'rdoc/task'
|
42
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
43
|
+
rdoc.rdoc_dir = 'rdoc'
|
44
|
+
rdoc.title = 'Spotlight::Dor::Resources'
|
45
|
+
rdoc.options << '--line-numbers'
|
46
|
+
rdoc.rdoc_files.include('README.rdoc')
|
47
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
48
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Spotlight::Resources
|
2
|
+
class DorResource < Spotlight::Resource
|
3
|
+
def to_solr
|
4
|
+
return to_enum :to_solr unless block_given?
|
5
|
+
|
6
|
+
base_doc = super
|
7
|
+
|
8
|
+
[resource, (resource.items if resource.collection?)].flatten.compact.each do |res|
|
9
|
+
yield base_doc.merge(Spotlight::Dor::Resources.indexer.solr_document(res))
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def resource
|
14
|
+
@resource ||= Spotlight::Dor::Resources.indexer.resource doc_id
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|