dor-services 5.0.1 → 5.0.2

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
  SHA1:
3
- metadata.gz: f49ca049f1d4c644bc7e51811bc36562298ba729
4
- data.tar.gz: 401af70a4012e11c8a26b8d9c0c3f871bd5b1a9e
3
+ metadata.gz: f18cae14cad4e7d46c99fd2805fb8517ef0d4020
4
+ data.tar.gz: 853c360a25789be6c4d541e20ddd5f875bf9aaca
5
5
  SHA512:
6
- metadata.gz: fd74c7ff789ae4e0e06f8dc29e8460501f64c8f765fee7addd406d61692fb7e83e037b5961a502a0d367a533dcecb112aea14a3e1e421128079b5862a22935b3
7
- data.tar.gz: bcab2bbfdcd50f81c5465633d62b1c7b5d4d198f5ce5824f742a4e2f34fc48930783ff7dd30bdab006859e9b8c2c5b68b3a43a450bc72db1d6b449dc3d3b89c1
6
+ metadata.gz: 06e4ded70b6d91f0751240b1b122260c6ac0d7994405e9e37b2192e83655235ad807d377a80114449ef3db79741b3d4084cc373d88bee1a495670fbed16822ac
7
+ data.tar.gz: 1624211169fdcfb9f7da970bb614a0f5e3d9704f9e551acde3d497c4f22b178f8c5a8c92c7aade636cf10c4fdf03387aba196b2d178029a4d8688ff90da665c0
@@ -157,10 +157,17 @@ module Dor
157
157
 
158
158
  def to_solr(solr_doc=Hash.new, *args)
159
159
  super solr_doc, *args
160
- # initialize multivalue targts if necessary
161
- %w[ metadata_format_ssim sw_language_tesim sw_genre_tesim sw_format_tesim
162
- sw_subject_temporal_tesim sw_subject_geographic_tesim mods_typeOfResource_tesim].each { |key|
163
- solr_doc[key] ||= []
160
+ mods_sources = {
161
+ 'sw_language_tesim' => :sw_language_facet,
162
+ 'sw_genre_tesim' => :sw_genre,
163
+ 'sw_format_tesim' => :format_main, # basically sw_typeOfResource_tesim
164
+ 'sw_subject_temporal_tesim' => :era_facet,
165
+ 'sw_subject_geographic_tesim' => :geographic_facet,
166
+ 'mods_typeOfResource_tesim' => [:term_values, :typeOfResource]
167
+ }
168
+ keys = mods_sources.keys.concat(%w[ metadata_format_ssim ])
169
+ keys.each { |key|
170
+ solr_doc[key] ||= [] # initialize multivalue targts if necessary
164
171
  }
165
172
 
166
173
  solr_doc["metadata_format_ssim"] << self.metadata_format
@@ -185,15 +192,7 @@ module Dor
185
192
 
186
193
  begin
187
194
  mods = self.stanford_mods
188
- sources = {
189
- 'sw_language_tesim' => :sw_language_facet,
190
- 'sw_genre_tesim' => :sw_genre,
191
- 'sw_format_tesim' => :format_main, # basically sw_typeOfResource_tesim
192
- 'sw_subject_temporal_tesim' => :era_facet,
193
- 'sw_subject_geographic_tesim' => :geographic_facet,
194
- 'mods_typeOfResource_tesim' => [:term_values, :typeOfResource]
195
- }
196
- sources.each_pair do |solr_key, meth|
195
+ mods_sources.each_pair do |solr_key, meth|
197
196
  vals = meth.is_a?(Array) ? mods.send(meth.shift, *meth) : mods.send(meth)
198
197
  solr_doc[solr_key].push *vals unless (vals.nil? || vals.empty?)
199
198
  # asterisk to avoid multi-dimensional array: push values, not the array
@@ -202,6 +201,8 @@ module Dor
202
201
  end
203
202
  # some fields get explicit "(none)" placeholder values, mostly for faceting
204
203
  %w[sw_language_tesim sw_genre_tesim sw_format_tesim].each { |key| solr_doc[key] = ['(none)'] if solr_doc[key].empty? }
204
+ # otherwise remove empties
205
+ keys.each{ |key| solr_doc.delete(key) if (solr_doc[key].nil? || solr_doc[key].empty?)}
205
206
  solr_doc
206
207
  end
207
208
 
data/lib/dor/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dor
2
- VERSION = '5.0.1'
2
+ VERSION = '5.0.2'
3
3
  end
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: 5.0.1
4
+ version: 5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-03-03 00:00:00.000000000 Z
15
+ date: 2015-03-09 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: active-fedora
@@ -174,14 +174,14 @@ dependencies:
174
174
  requirements:
175
175
  - - "~>"
176
176
  - !ruby/object:Gem::Version
177
- version: 1.6.7
177
+ version: '1.7'
178
178
  type: :runtime
179
179
  prerelease: false
180
180
  version_requirements: !ruby/object:Gem::Requirement
181
181
  requirements:
182
182
  - - "~>"
183
183
  - !ruby/object:Gem::Version
184
- version: 1.6.7
184
+ version: '1.7'
185
185
  - !ruby/object:Gem::Dependency
186
186
  name: rsolr-ext
187
187
  requirement: !ruby/object:Gem::Requirement