Skip to content

Commit

Permalink
Merge pull request #4660 from pulibrary/use-solr-params-for-notes-pub…
Browse files Browse the repository at this point in the history
…lisher

Include the solr parameters in Publisher and Notes fields for the advanced search
  • Loading branch information
christinach authored Dec 20, 2024
2 parents 6f91c10 + baf8af6 commit 90b5a53
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
27 changes: 27 additions & 0 deletions spec/features/advanced_searching_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 90b5a53

Please sign in to comment.