Class: CatalogController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- CatalogController
- Includes:
- Blacklight::Catalog, BlacklightAdvancedSearch::ParseBasicQ, Hydra::Controller::ControllerBehavior
- Defined in:
- lib/generators/sufia/templates/catalog_controller.rb
Instance Method Summary collapse
- #index ⇒ Object
- #recent ⇒ Object
- #recent_me ⇒ Object
-
#rsolr_request_error(exception) ⇒ Object
COPIED AND MODIFIED from: /usr/local/rvm/gems/ree-1.8.7-2011.03@scholarsphere/gems/blacklight-3.3.2/lib/blacklight/catalog.rb.
Instance Method Details
#index ⇒ Object
39 40 41 42 43 44 |
# File 'lib/generators/sufia/templates/catalog_controller.rb', line 39 def index super recent #also grab my recent docs too recent_me end |
#recent ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/generators/sufia/templates/catalog_controller.rb', line 46 def recent if user_signed_in? # grab other people's documents (resp, doc_list) = get_search_results(:q =>'{!lucene q.op=AND df=depositor_t}-'+current_user.user_key, :sort=>"system_create_dt desc", :rows=>3) else # grab any documents we do not know who you are (resp, doc_list) = get_search_results(:q =>'', :sort=>"system_create_dt desc", :rows=>3) end @recent_documents = doc_list[0..3] end |
#recent_me ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/generators/sufia/templates/catalog_controller.rb', line 57 def recent_me if user_signed_in? (resp, doc_list) = get_search_results(:q =>'{!lucene q.op=AND df=depositor_t}'+current_user.user_key, :sort=>"system_create_dt desc", :rows=>3) @recent_user_documents = doc_list[0..3] else @recent_user_documents = nil end end |
#rsolr_request_error(exception) ⇒ Object
COPIED AND MODIFIED from: /usr/local/rvm/gems/ree-1.8.7-2011.03@scholarsphere/gems/blacklight-3.3.2/lib/blacklight/catalog.rb
when solr (RSolr) throws an error (RSolr::RequestError), this method is executed.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/generators/sufia/templates/catalog_controller.rb', line 75 def rsolr_request_error(exception) #if Rails.env == "development" if ['development', 'integration'].include?(Rails.env) raise exception # Rails own code will catch and give usual Rails error page with stack trace else flash_notice = "Sorry, I don't understand your search." # Set the notice flag if the flash[:notice] is already set to the error that we are setting. # This is intended to stop the redirect loop error notice = flash[:notice] if flash[:notice] == flash_notice unless notice flash[:notice] = flash_notice redirect_to root_path, :status => 500 else render :template => "public/500.html", :layout => false, :status => 500 end end end |