Sha256: 95f04a83536b97f8ebb31ad47eca349e8983fcd17dd3038158c28ee3ac3b9c7c

Contents?: true

Size: 1.79 KB

Versions: 84

Compression:

Stored size: 1.79 KB

Contents

module Cul::Hydra::ApplicationIdBehavior
  extend ActiveSupport::Concern
  included do
    include Blacklight::SolrHelper
  end

  def find_for_params(path,solr_params)
    res = blacklight_solr.send_and_receive(path, {key=>solr_params.to_hash, method:blacklight_config.http_method})
    Blacklight::SolrResponse.new(res, solr_params, solr_document_model: blacklight_config.solr_document_model)
  end

  def get_solr_response_for_app_id(id=nil, extra_controller_params={})
    id ||= params[:id]
    id = id.clone
    id.sub!(/apt\:\/columbia/,'apt://columbia') # TOTAL HACK
    id.gsub!(':','\:')
    id.gsub!('/','\/')
    p = blacklight_config.default_document_solr_params.merge(extra_controller_params)
    p[:fq] = "identifier_ssim:#{(id)}"
    p[:fl] ||= '*'
    #p[:qt] ||= blacklight_config.document_solr_request_handler
    solr_response = find(blacklight_config.document_solr_path, p)
    raise Blacklight::Exceptions::InvalidSolrID.new(id) if solr_response.docs.empty?
    document = SolrDocument.new(solr_response.docs.first, solr_response)
    @response, @document = [solr_response, document]
  end

  def get_solr_response_for_dc_id(id=nil, extra_controller_params={})
    id ||= params[:id]
    id = id.clone
    p = blacklight_config.default_document_solr_params.merge(extra_controller_params)
    id.sub!(/apt\:\/columbia/,'apt://columbia') # TOTAL HACK
    id.gsub!(':','\:')
    id.gsub!('/','\/')
    p[:fq] = "dc_identifier_ssim:#{(id)}"
    p[:fl] ||= '*'
    #p[:qt] ||= blacklight_config.document_solr_request_handler
    solr_response = find(blacklight_config.document_solr_path, p)
    raise Blacklight::Exceptions::InvalidSolrID.new(id) if solr_response.docs.empty?
    document = SolrDocument.new(solr_response.docs.first, solr_response)
    @response, @document = [solr_response, document]
  end
end

Version data entries

84 entries across 84 versions & 2 rubygems

Version Path
cul_hydra-1.4.14 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.4.13 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.4.12 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.4.11 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.4.10 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.4.8 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.4.7 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.4.5 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.4.4 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.4.3 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.4.2 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.4.1 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.4.0 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.3.11 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.3.10 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.3.9 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.3.8 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.3.7 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.3.6 app/controllers/concerns/cul/hydra/application_id_behavior.rb
cul_hydra-1.3.5 app/controllers/concerns/cul/hydra/application_id_behavior.rb