Skip to content

Commit

Permalink
Merge pull request #1995 from pulibrary/use_change_the_subject_gem
Browse files Browse the repository at this point in the history
Use gem for ChangeTheSubject
  • Loading branch information
christinach authored Sep 19, 2022
2 parents ed8832e + 993b2b1 commit 184c31c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 261 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gem 'capistrano-passenger'
gem 'capistrano-rails', '~> 1.1.1'
gem 'capistrano-rails-console', require: false
gem 'capybara'
gem 'change_the_subject', '~> 0.2.0'
gem 'ddtrace', '~> 0.54.2'
gem 'devise'
gem 'faraday', '~> 1.0.1'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ GEM
celluloid (0.16.0)
timers (~> 4.0.0)
cgi (0.3.1)
change_the_subject (0.2.0)
yaml
childprocess (4.1.0)
chronic (0.10.2)
coderay (1.1.3)
Expand Down Expand Up @@ -598,6 +600,7 @@ DEPENDENCIES
capistrano-rails (~> 1.1.1)
capistrano-rails-console
capybara
change_the_subject (~> 0.2.0)
coveralls_reborn
ddtrace (~> 0.54.2)
devise
Expand Down
64 changes: 0 additions & 64 deletions marc_to_solr/lib/change_the_subject.rb

This file was deleted.

78 changes: 0 additions & 78 deletions marc_to_solr/lib/change_the_subject/change_the_subject.yml

This file was deleted.

10 changes: 5 additions & 5 deletions marc_to_solr/lib/traject_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'traject/macros/marc21_semantics'
require 'traject/macros/marc_format_classifier'
require 'bundler/setup'
require 'change_the_subject'
require_relative './format'
require_relative './princeton_marc'
require_relative './geo'
Expand All @@ -11,7 +12,6 @@
require_relative './solr_deleter'
require_relative './access_facet_builder'
require_relative './augment_the_subject'
require_relative './change_the_subject'
require_relative './pul_solr_json_writer'
require 'stringex'
require 'library_stdnums'
Expand Down Expand Up @@ -817,7 +817,7 @@
to_field 'lc_subject_display' do |record, accumulator|
subjects = process_hierarchy(record, '600|*0|abcdfklmnopqrtvxyz:610|*0|abfklmnoprstvxyz:611|*0|abcdefgklnpqstvxyz:630|*0|adfgklmnoprstvxyz:650|*0|abcvxyz:651|*0|avxyz')
subjects = augment_the_subject.add_indigenous_studies(subjects)
subjects = ChangeTheSubject.fix(subjects)
subjects = ChangeTheSubject.fix(subject_terms: subjects)
local_subjects = process_hierarchy(record, '650|*7|abcvxyz') { |field| local_heading? field }
accumulator.replace(subjects | local_subjects)
end
Expand All @@ -826,7 +826,7 @@
to_field 'lc_subject_include_archaic_search_terms_index' do |record, accumulator|
subjects = process_hierarchy(record, '600|*0|abcdfklmnopqrtvxyz:610|*0|abfklmnoprstvxyz:611|*0|abcdefgklnpqstvxyz:630|*0|adfgklmnoprstvxyz:650|*0|abcvxyz:651|*0|avxyz')
new_subjects = augment_the_subject.add_indigenous_studies(subjects)
new_subjects = ChangeTheSubject.fix(new_subjects)
new_subjects = ChangeTheSubject.fix(subject_terms: new_subjects)
combined_subjects = Array(subjects).concat(Array(new_subjects))&.uniq
accumulator.replace(combined_subjects)
end
Expand Down Expand Up @@ -860,7 +860,7 @@
to_field 'subject_facet' do |record, accumulator|
subjects = process_hierarchy(record, '600|*0|abcdfklmnopqrtvxyz:610|*0|abfklmnoprstvxyz:611|*0|abcdefgklnpqstvxyz:630|*0|adfgklmnoprstvxyz:650|*0|abcvxyz:651|*0|avxyz')
subjects = augment_the_subject.add_indigenous_studies(subjects)
subjects = ChangeTheSubject.fix(subjects)
subjects = ChangeTheSubject.fix(subject_terms: subjects)
additional_subject_thesauri = process_hierarchy(record, '650|*7|abcvxyz') { |field| siku_heading?(field) || local_heading?(field) || any_thesaurus_match?(field, %w[homoit]) }
genres = process_hierarchy(record, '655|*7|avxyz') { |field| any_thesaurus_match? field, %w[lcgft aat rbbin rbgenr rbmscv rbpap rbpri rbprov rbpub rbtyp homoit] }
accumulator.replace([subjects, additional_subject_thesauri, genres].flatten)
Expand Down Expand Up @@ -892,7 +892,7 @@
to_field 'subject_topic_facet' do |record, accumulator|
subjects = process_subject_topic_facet(record)
subjects = augment_the_subject.add_indigenous_studies(subjects)
subjects = ChangeTheSubject.fix(subjects)
subjects = ChangeTheSubject.fix(subject_terms: subjects)
accumulator.replace(subjects)
end

Expand Down
114 changes: 0 additions & 114 deletions spec/marc_to_solr/lib/change_the_subject_spec.rb

This file was deleted.

0 comments on commit 184c31c

Please sign in to comment.