Skip to content

Commit

Permalink
Merge branch 'main' into s3_for_primary_files
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf committed Nov 6, 2024
2 parents 51e58ee + 9f82ea1 commit f05d8d9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 42 deletions.
4 changes: 2 additions & 2 deletions app/controllers/catalog_controller_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
# see: https://github.com/scientist-softserv/adventist-dl/blob/97bd05946345926b2b6c706bd90e183a9d78e8ef/app/controllers/catalog_controller.rb#L38-L40
config.index_fields.keys.each do |key|
next if key == 'all_text_timv'
next if key == 'all_text_tsimv'
next if key == 'file_set_text_tsimv'

config.index_fields.delete(key)
Expand All @@ -62,7 +63,6 @@
{ prop => CatalogController.send(:index_options, prop, DogBiscuits.config.property_mappings[prop]) }
end
CatalogController.send(:add_index_field, config, index_props)
config.add_index_field 'all_text_tsimv', label: "Item contents", highlight: true, helper_method: :render_ocr_snippets, if: :query_present?
config.add_index_field 'based_near_label_tesim', itemprop: 'contentLocation', link_to_facet: 'based_near_label_sim'

config.search_fields.delete('all_fields')
Expand All @@ -74,7 +74,7 @@
DogBiscuits.config.all_properties.map { |p| "#{p}_tesim" }).uniq.join(" ")
title_name = 'title_tesim'
field.solr_parameters = {
qf: "#{all_names} file_format_tesim all_text_timv",
qf: "#{all_names} file_format_tesim all_text_timv all_text_tsimv",
pf: title_name.to_s
}
end
Expand Down
19 changes: 0 additions & 19 deletions app/helpers/hyku_knapsack/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,6 @@ def video_embed_viewer_display(work_presenter, locals = {})
def video_embed_viewer_display_partial(work_presenter)
'hyrax/base/' + work_presenter.video_embed_viewer.to_s
end

##
# This is in place to coerce the :q string to :query for passing the :q value to the query value
# of a IIIF Print manifest.
#
# @param doc [SolrDocument]
# @param request [ActionDispatch::Request]
def generate_work_url(doc, request)
url = super
return url if request.params[:q].blank?

key = doc.any_highlighting? ? 'parent_query' : 'query'
query = { key => request.params[:q] }.to_query
if url.include?("?")
url + "&#{query}"
else
url + "?#{query}"
end
end
end

# A Blacklight index field helper_method
Expand Down
20 changes: 0 additions & 20 deletions spec/helpers/hyku_knapsack/application_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,4 @@
before do
allow(helper).to receive(:current_account) { account }
end

describe '#generate_work_url' do
context 'when params has a "q" parameter' do
let(:q) { "wonka-vision" }

context 'when any_highlighting? is false' do
it 'passes that along as :query' do
expect(doc).to receive(:any_highlighting?).and_return(false)
expect(helper.generate_work_url(doc, request)).to end_with("?query=#{q}")
end
end

context 'when any_highlighting? is true' do
it 'passes that along as :parent_query' do
expect(doc).to receive(:any_highlighting?).and_return(true)
expect(helper.generate_work_url(doc, request)).to end_with("?parent_query=#{q}")
end
end
end
end
end

0 comments on commit f05d8d9

Please sign in to comment.