Skip to content

Commit

Permalink
Fix metadata parsing for subjects and repos (#32)
Browse files Browse the repository at this point in the history
* fix metadata parsing for subjects and repos

* update code comment to reflect change

* Updating Gem version to 3.0.0-beta.6.

Co-authored-by: Phil Plencner <[email protected]>
  • Loading branch information
bkiahstroud and phil-plencner-hl authored Sep 9, 2022
1 parent 66d5c6d commit 4c1de6b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ GIT
PATH
remote: .
specs:
spotlight-oaipmh-resources (3.0.0.pre.beta.5)
spotlight-oaipmh-resources (3.0.0.pre.beta.6)
mods
oai

Expand Down
11 changes: 5 additions & 6 deletions app/models/spotlight/resources/oaipmh_mods_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def add_document_id
def parse_subjects()
subject_field_name = @converter.get_spotlight_field_name('subjects_ssim')
if @item_solr.key?(subject_field_name) && !@item_solr[subject_field_name].nil?
#Split on |
subjects = @item_solr[subject_field_name].split('|')
# Split on | and ,
subjects = @item_solr[subject_field_name].split(/[|,]/).flatten
@item_solr[subject_field_name] = subjects
@item_sidecar['subjects_ssim'] = subjects
end
Expand Down Expand Up @@ -138,10 +138,9 @@ def uniquify_repos(repository_field_name)
#If the repository exists, make sure it has unique values
if @item_solr.key?(repository_field_name) && @item_solr[repository_field_name].present?
repoarray = @item_solr[repository_field_name].split('|')
repoarray = repoarray.uniq
repo = repoarray.join('|')
@item_solr[repository_field_name] = repo
@item_sidecar['repository_ssim'] = repo
repoarray = repoarray.flatten.uniq
@item_solr[repository_field_name] = repoarray
@item_sidecar['repository_ssim'] = repoarray
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/spotlight/oaipmh/resources/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Spotlight
module Oaipmh
# :nodoc:
module Resources
VERSION = "3.0.0-beta.5"
VERSION = "3.0.0-beta.6"
end
end
end

0 comments on commit 4c1de6b

Please sign in to comment.