From 2c7cf113a796fbb61c05bd45877cfc70a49e4e8d Mon Sep 17 00:00:00 2001 From: Christina Chortaria Date: Mon, 21 Aug 2023 12:20:04 -0400 Subject: [PATCH 1/4] Update deploy qa file to read rails_env:qa (#3692) --- config/alma.yml | 2 +- config/blacklight.yml | 3 --- config/database.yml | 2 -- config/deploy/qa.rb | 2 +- config/orangelight.yml | 9 --------- config/redis.yml | 4 ---- config/secrets.yml | 2 -- 7 files changed, 2 insertions(+), 22 deletions(-) diff --git a/config/alma.yml b/config/alma.yml index fc4463ccb..8e0a76f5e 100644 --- a/config/alma.yml +++ b/config/alma.yml @@ -8,7 +8,7 @@ test: <<: *default read_write_apikey: 'TESTME' -alma_qa: +qa: <<: *default staging: diff --git a/config/blacklight.yml b/config/blacklight.yml index 5186269b6..078e90bd6 100644 --- a/config/blacklight.yml +++ b/config/blacklight.yml @@ -19,9 +19,6 @@ test: &test staging: adapter: solr url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8983/solr/blacklight-core" %> -alma_qa: - adapter: solr - url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8983/solr/blacklight-core" %> qa: adapter: solr url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8983/solr/blacklight-core" %> diff --git a/config/database.yml b/config/database.yml index a0d37186f..183a6871c 100644 --- a/config/database.yml +++ b/config/database.yml @@ -64,7 +64,5 @@ production: staging: <<: *default -alma_qa: - <<: *default qa: <<: *default diff --git a/config/deploy/qa.rb b/config/deploy/qa.rb index 05fca2c34..ea78eb509 100644 --- a/config/deploy/qa.rb +++ b/config/deploy/qa.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true set :rvm_ruby_string, :local # use the same ruby as used locally for deployment -set :rails_env, 'alma_qa' +set :rails_env, 'qa' set :branch, ENV['BRANCH'] || 'main' server 'catalog-qa1.princeton.edu', user: 'deploy', roles: %i[web app db worker mailcatcher cron_db] diff --git a/config/orangelight.yml b/config/orangelight.yml index 3183f70e3..ca9f033c1 100644 --- a/config/orangelight.yml +++ b/config/orangelight.yml @@ -71,15 +71,6 @@ staging: exchange: 'orangelight_events' firestone_locator_base_url: https://locator-staging.princeton.edu -alma_qa: - <<: *defaults - redis: - host: <%= ENV['OL_REDIS_HOST'] %> - port: <%= ENV['OL_REDIS_PORT'] || '6379' %> - db: 'orangelight_qa' - events: - server: <%= ENV['OL_RABBIT_SERVER'] || 'amqp://localhost:5672' %> - exchange: 'orangelight_events' qa: <<: *defaults redis: diff --git a/config/redis.yml b/config/redis.yml index 4f2cc5e58..a91985f68 100644 --- a/config/redis.yml +++ b/config/redis.yml @@ -18,10 +18,6 @@ staging: <<: *defaults host: <%= ENV['OL_REDIS_HOST'] %> port: <%= ENV['OL_REDIS_PORT'] || '6379' %> -alma_qa: - <<: *defaults - host: <%= ENV['OL_REDIS_HOST'] %> - port: <%= ENV['OL_REDIS_PORT'] || '6379' %> qa: <<: *defaults host: <%= ENV['OL_REDIS_HOST'] %> diff --git a/config/secrets.yml b/config/secrets.yml index bb3b7d2aa..c9f270e05 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -23,7 +23,5 @@ production: staging: secret_key_base: <%= ENV['OL_SECRET_KEY_BASE'] %> -alma_qa: - secret_key_base: <%= ENV['OL_SECRET_KEY_BASE'] %> qa: secret_key_base: <%= ENV['OL_SECRET_KEY_BASE'] %> From 5709396e44d2cb09fe3a80e2e69cfeb14401e067 Mon Sep 17 00:00:00 2001 From: rladdusaw Date: Tue, 22 Aug 2023 11:13:13 -0500 Subject: [PATCH 2/4] Added flipper feature for new aeon url (#3694) * Added flipper feature for new aeon url * Moved Flipflop call out of controller --------- Co-authored-by: Ryan Laddusaw --- Gemfile.lock | 2 +- .../requests/request_controller.rb | 2 +- app/helpers/requests/application_helper.rb | 4 + app/models/requests/aeon_url.rb | 4 +- app/models/requests/requestable_decorator.rb | 3 +- config/features.rb | 4 + config/requests.yml | 5 +- spec/features/login_account_spec.rb | 79 +++++++++++++++---- spec/models/requests/aeon_url_spec.rb | 19 ++++- spec/models/requests/requestable_spec.rb | 22 +++++- 10 files changed, 116 insertions(+), 28 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2b1cf651c..309657330 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -505,7 +505,7 @@ GEM sprockets-rails tilt scrub_rb (1.0.1) - selenium-webdriver (4.10.0) + selenium-webdriver (4.11.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) diff --git a/app/controllers/requests/request_controller.rb b/app/controllers/requests/request_controller.rb index 4d6eec7b7..ae769c6e6 100644 --- a/app/controllers/requests/request_controller.rb +++ b/app/controllers/requests/request_controller.rb @@ -41,7 +41,7 @@ def redirect_single_aeon_thesis_numistatics ### redirect to Aeon for thesis or coin items or single Aeon requestable ### or over 500 Aeon requestable if @request.thesis? || @request.numismatics? - redirect_to "#{Requests::Config[:aeon_base]}?#{@request.requestable.first.aeon_mapped_params.to_query}" + redirect_to "#{aeon_base}?#{@request.requestable.first.aeon_mapped_params.to_query}" elsif @request.single_aeon_requestable? redirect_to @request.first_filtered_requestable.aeon_request_url end diff --git a/app/helpers/requests/application_helper.rb b/app/helpers/requests/application_helper.rb index 4727255dc..6cbd80f20 100644 --- a/app/helpers/requests/application_helper.rb +++ b/app/helpers/requests/application_helper.rb @@ -382,6 +382,10 @@ def single_pickup(is_charged, name, id, location) label = label_tag id, "Pick-up location: #{location[:label]}", class: 'single-pick-up', style: style.to_s hidden + label end + + def aeon_base + Flipflop.deprecated_aeon_base? ? Requests::Config[:aeon_base_deprecated] : Requests::Config[:aeon_base] + end end end # rubocop:enable Metrics/ModuleLength diff --git a/app/models/requests/aeon_url.rb b/app/models/requests/aeon_url.rb index 0e15c8eb0..c4c382f22 100644 --- a/app/models/requests/aeon_url.rb +++ b/app/models/requests/aeon_url.rb @@ -12,7 +12,9 @@ def initialize(document:, holding: nil, item: nil) end def to_s - @compiled_string ||= "#{Requests::Config[:aeon_base]}/OpenURL?#{query_string}" + aeon_url = Flipflop.deprecated_aeon_base? ? Requests::Config[:aeon_base_deprecated] : Requests::Config[:aeon_base] + aeon_connector = Flipflop.deprecated_aeon_base? ? "/OpenURL?" : "?Action=10&Form=30&" + @compiled_string ||= "#{aeon_url}#{aeon_connector}#{query_string}" end private diff --git a/app/models/requests/requestable_decorator.rb b/app/models/requests/requestable_decorator.rb index eceea87ab..b3273fecf 100644 --- a/app/models/requests/requestable_decorator.rb +++ b/app/models/requests/requestable_decorator.rb @@ -145,7 +145,8 @@ def aeon_url(_request_ctx) if requestable.alma_managed? requestable.aeon_request_url else - "#{Requests::Config[:aeon_base]}?#{requestable.aeon_mapped_params.to_query}" + aeon_url = Flipflop.deprecated_aeon_base? ? Requests::Config[:aeon_base_deprecated] : Requests::Config[:aeon_base] + "#{aeon_url}?#{requestable.aeon_mapped_params.to_query}" end end diff --git a/config/features.rb b/config/features.rb index 6dde0cea8..8105badd1 100644 --- a/config/features.rb +++ b/config/features.rb @@ -31,6 +31,10 @@ default: false, description: "When on / true, displays the message set by the announcement rake task." + feature :deprecated_aeon_base, + default: true, + description: "When on / true use the old Aeon base URL instead of the new ones. Uses the Atlas-hosted url in staging and QA." + group :blacklight_8 do feature :json_query_dsl, description: "When on / true, use the JSON query DSL for search fields in the advanced search. When off / false, use query params" diff --git a/config/requests.yml b/config/requests.yml index c4bb8a478..c7605373e 100644 --- a/config/requests.yml +++ b/config/requests.yml @@ -4,7 +4,8 @@ defaults: &defaults bibdata_base: <%= ENV['BIBDATA_BASE'] || "https://bibdata.princeton.edu" %> proxy_base: https://login.ezproxy.princeton.edu/login?url= pulsearch_base: https://catalog.princeton.edu - aeon_base: https://lib-aeon.princeton.edu/aeon/aeon.dll + aeon_base_deprecated: https://lib-aeon.princeton.edu/aeon/aeon.dll + aeon_base: https://lib-aeon.princeton.edu/logon gfa_base: http://libweb5.princeton.edu/ReCAPNoUI/Default.aspx ill_base: https://lib-illiad.princeton.edu/illiad/illiad.dll/OpenURL scsb_base: https://scsb.recaplib.org:9093 @@ -28,10 +29,12 @@ production: <<: *defaults staging: <<: *defaults + aeon_base: https://princeton.aeon.atlas-sys.com/logon pulsearch_base: https://catalog-staging.princeton.edu bibdata_base: <%= ENV['BIBDATA_BASE'] || "https://bibdata-staging.princeton.edu" %> qa: <<: *defaults + aeon_base: https://princeton.aeon.atlas-sys.com/logon bibdata_base: <%= ENV['BIBDATA_BASE'] || "https://bibdata-qa.princeton.edu" %> # scsb_base: https://uat-recap.htcinc.com:9093 scsb_base: https://scsb.recaplib.org:9093 diff --git a/spec/features/login_account_spec.rb b/spec/features/login_account_spec.rb index 8a41cface..33115d507 100644 --- a/spec/features/login_account_spec.rb +++ b/spec/features/login_account_spec.rb @@ -152,12 +152,27 @@ stub_catalog_raw(bib_id: 'coin-1167', type: 'numismatics') stub_single_holding_location('rare$num') end - - it 'does not require authentication', js: true do - visit "/catalog/coin-1167" - expect(page).to have_link('Reading Room Request', href: Regexp.new('https://lib-aeon\.princeton\.edu/aeon/aeon\.dll/OpenURL.*Coin.1167')) - click_link('Reading Room Request') - expect(page.current_url).to include(Requests::Config[:aeon_base]) + describe 'using the deprecated aeon base' do + before do + allow(Flipflop).to receive(:deprecated_aeon_base?).and_return(true) + end + it 'does not require authentication', js: true do + visit "/catalog/coin-1167" + expect(page).to have_link('Reading Room Request', href: Regexp.new('https://lib-aeon\.princeton\.edu/aeon/aeon\.dll/OpenURL.*Coin.1167')) + click_link('Reading Room Request') + expect(page.current_url).to include(Requests::Config[:aeon_base_deprecated]) + end + end + describe 'using the new aeon base' do + before do + allow(Flipflop).to receive(:deprecated_aeon_base?).and_return(false) + end + it 'does not require authentication', js: true do + visit "/catalog/coin-1167" + expect(page).to have_link('Reading Room Request', href: Regexp.new('https://lib-aeon\.princeton\.edu/logon.*Coin.1167')) + click_link('Reading Room Request') + expect(page.current_url).to include(Requests::Config[:aeon_base]) + end end end describe 'requesting a thesis' do @@ -165,11 +180,27 @@ stub_catalog_raw(bib_id: 'dsp01tq57ns24j', type: 'theses_and_dissertations') stub_single_holding_location('mudd$stacks') end - it 'does not require authentication', js: true do - visit "/catalog/dsp01tq57ns24j" - expect(page).to have_link('Reading Room Request', href: Regexp.new('https://lib-aeon\.princeton\.edu/aeon/aeon\.dll/OpenURL.*dsp01tq57ns24j')) - click_link('Reading Room Request') - expect(page.current_url).to include(Requests::Config[:aeon_base]) + describe 'using the deprecated aeon base' do + before do + allow(Flipflop).to receive(:deprecated_aeon_base?).and_return(true) + end + it 'does not require authentication', js: true do + visit "/catalog/dsp01tq57ns24j" + expect(page).to have_link('Reading Room Request', href: Regexp.new('https://lib-aeon\.princeton\.edu/aeon/aeon\.dll/OpenURL.*dsp01tq57ns24j')) + click_link('Reading Room Request') + expect(page.current_url).to include(Requests::Config[:aeon_base_deprecated]) + end + end + describe 'using the new aeon base' do + before do + allow(Flipflop).to receive(:deprecated_aeon_base?).and_return(false) + end + it 'does not require authentication', js: true do + visit "/catalog/dsp01tq57ns24j" + expect(page).to have_link('Reading Room Request', href: Regexp.new('https://lib-aeon\.princeton\.edu/logon.*dsp01tq57ns24j')) + click_link('Reading Room Request') + expect(page.current_url).to include(Requests::Config[:aeon_base]) + end end end describe 'requesting a special collections holding with a single item' do @@ -180,11 +211,27 @@ stub_single_holding_location('rare$map') stub_availability_by_holding_id(bib_id:, holding_id: '22745123330006421') end - it 'does not require authentication', js: true do - visit "/catalog/#{bib_id}" - expect(page).to have_link('Reading Room Request', href: Regexp.new('https://lib-aeon\.princeton\.edu/aeon/aeon\.dll/OpenURL.*CallNumber\=RECAP-94760855')) - click_link('Reading Room Request', href: Regexp.new('https://lib-aeon\.princeton\.edu/aeon/aeon\.dll/OpenURL.*CallNumber\=RECAP-94760855')) - expect(page.current_url).to include(Requests::Config[:aeon_base]) + describe 'using the deprecated aeon base' do + before do + allow(Flipflop).to receive(:deprecated_aeon_base?).and_return(true) + end + it 'does not require authentication', js: true do + visit "/catalog/#{bib_id}" + expect(page).to have_link('Reading Room Request', href: Regexp.new('https://lib-aeon\.princeton\.edu/aeon/aeon\.dll/OpenURL.*CallNumber\=RECAP-94760855')) + click_link('Reading Room Request', href: Regexp.new('https://lib-aeon\.princeton\.edu/aeon/aeon\.dll/OpenURL.*CallNumber\=RECAP-94760855')) + expect(page.current_url).to include(Requests::Config[:aeon_base_deprecated]) + end + end + describe 'using the new aeon base' do + before do + allow(Flipflop).to receive(:deprecated_aeon_base?).and_return(false) + end + it 'does not require authentication', js: true do + visit "/catalog/#{bib_id}" + expect(page).to have_link('Reading Room Request', href: Regexp.new('https://lib-aeon\.princeton\.edu/logon.*CallNumber\=RECAP-94760855')) + click_link('Reading Room Request', href: Regexp.new('https://lib-aeon\.princeton\.edu/logon.*CallNumber\=RECAP-94760855')) + expect(page.current_url).to include(Requests::Config[:aeon_base]) + end end end end diff --git a/spec/models/requests/aeon_url_spec.rb b/spec/models/requests/aeon_url_spec.rb index 0aa54466a..95db329e1 100644 --- a/spec/models/requests/aeon_url_spec.rb +++ b/spec/models/requests/aeon_url_spec.rb @@ -22,9 +22,6 @@ stub_holding_locations end subject { described_class.new(document:).to_s } - it 'begins with the aeon prefix' do - expect(subject).to match(/^#{Requests::Config[:aeon_base]}/) - end it 'uses the document id as the ReferenceNumber' do expect(subject).to include('ReferenceNumber=9999999') end @@ -43,6 +40,22 @@ it 'takes the ItemNumber from the barcode' do expect(subject).to include('ItemNumber=24680') end + context 'when using the deprecated aeon base url' do + before do + allow(Flipflop).to receive(:deprecated_aeon_base?).and_return(true) + end + it 'begins with the aeon prefix' do + expect(subject).to match(/^#{Requests::Config[:aeon_base_deprecated]}/) + end + end + context 'when using the new aeon base url' do + before do + allow(Flipflop).to receive(:deprecated_aeon_base?).and_return(false) + end + it 'begins with the aeon prefix' do + expect(subject).to match(/^#{Requests::Config[:aeon_base]}/) + end + end context 'when the location is at a Mudd location' do let(:holdings) do { "12345" => { diff --git a/spec/models/requests/requestable_spec.rb b/spec/models/requests/requestable_spec.rb index bfb0ec470..e9d1a57dc 100644 --- a/spec/models/requests/requestable_spec.rb +++ b/spec/models/requests/requestable_spec.rb @@ -682,10 +682,24 @@ end end - describe '#aeon_request_url' do - it 'beings with Aeon GFA base' do - stub_holding_locations - expect(requestable.aeon_request_url).to match(/^#{Requests::Config[:aeon_base]}/) + context 'with aeon base feature flipper' do + describe '#aeon_request_url with deprecated aeon base' do + before do + allow(Flipflop).to receive(:deprecated_aeon_base?).and_return(true) + end + it 'beings with Aeon GFA base' do + stub_holding_locations + expect(requestable.aeon_request_url).to match(/^#{Requests::Config[:aeon_base_deprecated]}/) + end + end + describe '#aeon_request_url with new aeon base' do + before do + allow(Flipflop).to receive(:deprecated_aeon_base?).and_return(false) + end + it 'beings with Aeon GFA base' do + stub_holding_locations + expect(requestable.aeon_request_url).to match(/^#{Requests::Config[:aeon_base]}/) + end end end From 1da0cc10f75a2001e6be36baea1295af433ea8e2 Mon Sep 17 00:00:00 2001 From: Ryan Laddusaw Date: Tue, 22 Aug 2023 15:20:03 -0500 Subject: [PATCH 3/4] Updated with latest solrconfig and schema --- solr/conf/schema.xml | 7 -- solr/conf/solrconfig.xml | 240 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 240 insertions(+), 7 deletions(-) diff --git a/solr/conf/schema.xml b/solr/conf/schema.xml index a72e9d4bf..80fb1c409 100644 --- a/solr/conf/schema.xml +++ b/solr/conf/schema.xml @@ -577,12 +577,6 @@ - - - @@ -750,7 +744,6 @@ - diff --git a/solr/conf/solrconfig.xml b/solr/conf/solrconfig.xml index ffa3baaf6..fb0123701 100644 --- a/solr/conf/solrconfig.xml +++ b/solr/conf/solrconfig.xml @@ -361,6 +361,246 @@ + + + + + lucene + explicit + 10 + on + text + *:* + + + + + + + + + title_a_index^1500 + author_main_unstem_search^1000 + title_unstem_search^40 + title_display^40 + author_unstem_search^40 + subject_topic_unstem_search^18 + subject_unstem_search^15 + siku_subject_unstem_search^15 + local_subject_unstem_search^15 + homoit_subject_unstem_search^15 + subject_topic_index^12 + genre_unstem_search^10 + subject_t^10 + subject_addl_unstem_search^8 + subject_addl_t^4 + isbn_t^3 + issn_s^3 + lccn_s^3 + uncontrolled_keyword_unstem_search^3 + text + description_t + cjk_all + cjk_text + + + title_245a_lr^16000 + title_245_lr^16000 + title_a_index^12000 + author_main_unstem_search^10000 + title_unstem_search^400 + title_display^400 + author_unstem_search^400 + subject_topic_unstem_search^180 + subject_unstem_search^150 + siku_subject_unstem_search^150 + local_subject_unstem_search^150 + homoit_subject_unstem_search^150 + subject_topic_index^120 + genre_unstem_search^100 + subject_t^100 + subject_addl_unstem_search^80 + subject_addl_t^40 + isbn_t^30 + issn_s^30 + lccn_s^30 + uncontrolled_keyword_unstem_search^10 + text^10 + description_t^10 + cjk_all^10 + cjk_text^10 + + + author_main_unstem_search^20 + author_unstem_search^10 + cjk_author + + + author_main_unstem_search^200 + author_unstem_search^100 + cjk_author^10 + + + title_245a_la^50 + title_245_la^10 + title_la^2 + title_addl_la + + + title_245a_lr^600 + title_245_lr^600 + title_245a_la^500 + title_245_la^100 + title_lr^100 + title_la^20 + title_addl_la^10 + + + more_in_this_series_la + + + more_in_this_series_la + + + pub_created_unstem_search + cjk_publisher + + + pub_created_unstem_search + cjk_publisher + + + notes_index + cjk_notes + cjk_notes_copied + + + notes_index + cjk_notes + cjk_notes_copied + + + series_title_index^5 + series_ae_index + series_statement_index + linked_series_title_index + linked_series_index + original_version_series_index + cjk_series_title + + + series_title_index^50 + series_ae_index^10 + series_statement_index^10 + linked_series_title_index^10 + linked_series_index^10 + original_version_series_index^10 + cjk_series_title^10 + + + title_a_index^500 + title_unstem_search^100 + title_display^50 + other_title_index^5 + series_title_index^5 + uniform_title_s^5 + title_vern_display + content_title_index + contains_title_index + linked_title_index + series_ae_index + series_statement_index + linked_series_title_index + linked_series_index + original_version_series_index + cjk_title + + + title_245a_lr^5500 + title_245_lr^5500 + title_a_index^5000 + title_unstem_search^1000 + title_display^500 + other_title_index^50 + series_title_index^50 + uniform_title_s^50 + title_vern_display^10 + content_title_index^10 + contains_title_index^10 + linked_title_index^10 + series_ae_index^10 + series_statement_index^10 + linked_series_title_index^10 + linked_series_index^10 + original_version_series_index^10 + cjk_title^10 + + + subject_topic_unstem_search^25 + subject_unstem_search^20 + genre_unstem_search^15 + siku_subject_unstem_search + local_subject_unstem_search + homoit_subject_unstem_search + cjk_subject + + + subject_topic_unstem_search^250 + subject_unstem_search^200 + genre_unstem_search^150 + siku_subject_unstem_search^10 + local_subject_unstem_search^10 + homoit_subject_unstem_search^10 + cjk_subject^10 + + + 3 + 0.01 + + + id, + score, + author_display, + marc_relator_display, + format, + pub_created_display, + title_display, + title_vern_display, + isbn_s, + oclc_s, + lccn_s, + holdings_1display, + electronic_access_1display, + electronic_portfolio_s, + cataloged_tdt, + contained_in_s + + + true + 1 + 10 + format + language_facet + pub_date_start_sort + advanced_location_s + index + index + 1000 + 500 + + + From b7c441730f3c22a7daae8a40df4f66215b941d67 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Tue, 22 Aug 2023 15:47:56 -0700 Subject: [PATCH 4/4] Refresh solr configs from pul_solr --- solr/conf/schema.xml | 151 ++++++------------------------------------- 1 file changed, 21 insertions(+), 130 deletions(-) diff --git a/solr/conf/schema.xml b/solr/conf/schema.xml index 80fb1c409..3c9752530 100644 --- a/solr/conf/schema.xml +++ b/solr/conf/schema.xml @@ -190,11 +190,29 @@ - + + + + + + + + + + + + + + + + + + - + @@ -255,139 +273,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +