From baf8af626dea1c04d90ee3536fbcd92a9457d87d Mon Sep 17 00:00:00 2001 From: Christina Chortaria Date: Fri, 20 Dec 2024 15:29:39 -0500 Subject: [PATCH] Include the solr parameters in Publisher and Notes fields for the advanced search Without these they behave like the keyword search This is fixing a regression related to removing the advanced search gem and replacing it with the built-in advanced search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to @caroldh who found this bug! šŸ› Co-authored-by: Jane Sandberg --- app/controllers/catalog_controller.rb | 12 +++++------ spec/features/advanced_searching_spec.rb | 27 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index 7b5f8273f..bc66b7804 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -564,9 +564,9 @@ class CatalogController < ApplicationController config.add_search_field('publisher') do |field| field.include_in_simple_select = false field.label = 'Publisher' - field.solr_adv_parameters = { - qf: '$publisher_qf', - pf: '$publisher_pf' + field.solr_parameters = { + qf: '${publisher_qf}', + pf: '${publisher_pf}' } end @@ -587,9 +587,9 @@ class CatalogController < ApplicationController config.add_search_field('notes') do |field| field.include_in_simple_select = false field.label = 'Notes' - field.solr_adv_parameters = { - qf: '$notes_qf', - pf: '$notes_pf' + field.solr_parameters = { + qf: '${notes_qf}', + pf: '${notes_pf}' } end diff --git a/spec/features/advanced_searching_spec.rb b/spec/features/advanced_searching_spec.rb index 0fe65f3d7..d7c7ee258 100644 --- a/spec/features/advanced_searching_spec.rb +++ b/spec/features/advanced_searching_spec.rb @@ -207,4 +207,31 @@ click_button 'Search' expect(page).to have_content '1 entry found' end + it 'gives different results for the publisher search vs. keyword search' do + visit '/advanced' + select('Keyword', from: 'clause_0_field') + fill_in(id: 'clause_0_query', with: 'Center') + click_button 'Search' + expect(page).to have_content 'Zhong gong zhong yao li shi wen' + + visit '/advanced' + select('Publisher', from: 'clause_0_field') + fill_in(id: 'clause_0_query', with: 'Center') + click_button 'Search' + expect(page).to have_content 'Boulder, Col. : The Center, 1978-' + expect(page).not_to have_content 'Service Center for Chinese Publications' + end + it 'gives different results for the notes search vs. keyword search' do + visit '/advanced' + select('Keyword', from: 'clause_0_field') + fill_in(id: 'clause_0_query', with: 'Turkish') + click_button 'Search' + expect(page).to have_content 'Ahmet Kutsi Tecer sempozyum bildirileri : Sıvas 24 - 27 Nisan 2018' + + visit '/advanced' + select('Notes', from: 'clause_0_field') + fill_in(id: 'clause_0_query', with: 'Turkish') + click_button 'Search' + expect(page).not_to have_content 'Ahmet Kutsi Tecer sempozyum bildirileri : Sıvas 24 - 27 Nisan 2018' + end end