Class: OcrSearchController

Inherits:
CatalogController
  • Object
show all
Includes:
Blacklight::Configurable, Blacklight::SearchHelper, CommonwealthVlrEngine::CatalogHelper
Defined in:
app/controllers/ocr_search_controller.rb

Instance Method Summary collapse

Methods included from CommonwealthVlrEngine::CatalogHelper

#cc_terms_code, #cc_url, #collection_gallery_url, #collection_icon_path, #create_download_links, #create_thumb_img_element, #extra_body_classes, #has_downloadable_files?, #has_image_files?, #ia_download_title, #index_collection_link, #index_date_value, #index_institution_link, #index_relation_base_icon, #index_slideshow_img_url, #index_title_length, #institution_icon_path, #link_to_az_value, #normalize_date, #render_cc_license, #render_full_title, #render_hiergo_subject, #render_item_breadcrumb, #render_main_title, #render_mlt_search_link, #render_mods_date, #render_mods_dates, #render_mods_xml_record, #render_volume_title, #return_oai_inst_name, #setup_collection_links, #setup_names_roles, #should_autofocus_on_search_box?, #thumbnail_url

Instance Method Details

#indexObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/ocr_search_controller.rb', line 13

def index
  @doc_response, @document = fetch(params[:id])
  if params[:ocr_q]
    @image_pid_list = has_image_files?(get_files(params[:id]))
    ocr_search_params = {q: params[:ocr_q],
                         f: {'is_file_of_ssim' => "info:fedora/#{params[:id]}"}}
    ocr_search_params[:page] = params[:page] if params[:page]
    ocr_search_params[:sort] = params[:sort] if params[:sort]
    # for some reason, have to set :fl here, or gets scrubbed out of ocr_search_params somehow
    blacklight_config.default_solr_params[:fl] =
        "id,#{blacklight_config.page_num_field},#{termfreq_query(params[:ocr_q])}"
    (@response, @document_list) = search_results(ocr_search_params)
  else
    (@response, @document_list) = {},[]
  end

  respond_to do |format|
    # Draw the facet selector for users who have javascript disabled:
    format.html
    # Draw the partial for the ocr search results modal window:
    format.js { render :layout => false }
  end
end