Skip to content

Commit

Permalink
BL-1855 Move advanced path override to separate method (#4834)
Browse files Browse the repository at this point in the history
  • Loading branch information
sensei100 authored Dec 20, 2024
1 parent 9b7f92c commit 87e2644
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class CatalogController < ApplicationController
before_action :set_thread_request
before_action only: :index do
override_solr_path
advanced_override_path
blacklight_config.max_per_page = 50
if params[:page] && params[:page].to_i > 250
flash[:error] = t("blacklight.errors.deep_paging")
Expand All @@ -31,7 +32,9 @@ def override_solr_path
if single_word && quoted_phrase
blacklight_config.solr_path = "single_quoted_search"
end
end

def advanced_override_path
if params["q_1"]&.split&.count == 1 && params["operator"]["q_1"] == "is"
blacklight_config.solr_path = "single_quoted_search"
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/databases_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class DatabasesController < CatalogController

helper_method :join

def override_solr_path
def advanced_override_path
end

configure_blacklight do |config|
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/primo_central_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ class PrimoCentralController < CatalogController
helper_method :tags_strip
helper_method :solr_range_queries_to_a

def advanced_override_path
end

rescue_from ArticleNotFound, with: :invalid_document_id_error
rescue_from Net::ReadTimeout, with: :net_read_timeout_rescue

def override_solr_path
end

configure_blacklight do |config|
# Class for sending and receiving requests from a search index
config.repository_class = Blacklight::PrimoCentral::Repository
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/web_content_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
class WebContentController < CatalogController
include CatalogConfigReinit

def advanced_override_path
end

configure_blacklight do |config|
# Remove show and index doc actions.
config.index.document_actions = Blacklight::NestedOpenStructWithHashAccess.new({})
Expand Down

0 comments on commit 87e2644

Please sign in to comment.