Skip to content

Commit

Permalink
Changing get_solr_repsonse_for_doc_id so that it returns both the res…
Browse files Browse the repository at this point in the history
…ponse and the document as a SolrDocument
  • Loading branch information
mpc3c authored and mpc3c committed Nov 17, 2009
1 parent 94069ee commit 12f720e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
15 changes: 5 additions & 10 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ def index

# get single document from the solr index
def show
@response = get_solr_response_for_doc_id
@document = SolrDocument.new(@response.docs.first)
@response, @document = get_solr_response_for_doc_id
respond_to do |format|
format.html {setup_next_and_previous_documents}
format.xml {render :xml => @document.marc.to_xml}
Expand Down Expand Up @@ -87,24 +86,20 @@ def opensearch

# citation action
def citation
@response = get_solr_response_for_doc_id
@document = SolrDocument.new(@response.docs.first)
@response, @document = get_solr_response_for_doc_id
end
# Email Action (this will only be accessed when the Email link is clicked by a non javascript browser)
def email
@response = get_solr_response_for_doc_id
@document = SolrDocument.new(@response.docs.first)
@response, @document = get_solr_response_for_doc_id
end
# SMS action (this will only be accessed when the SMS link is clicked by a non javascript browser)
def sms
@response = get_solr_response_for_doc_id
@document = SolrDocument.new(@response.docs.first)
@response, @document = get_solr_response_for_doc_id
end

# action for sending email. This is meant to post from the form and to do processing
def send_email_record
@response = get_solr_response_for_doc_id
@document = SolrDocument.new(@response.docs.first)
@response, @document = get_solr_response_for_doc_id
if params[:to]
from = request.host # host w/o port for From address (from address cannot have port#)
host = request.host
Expand Down
3 changes: 2 additions & 1 deletion lib/blacklight/solr_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def solr_doc_params(id=nil, extra_controller_params={})
def get_solr_response_for_doc_id(id=nil, extra_controller_params={})
solr_response = Blacklight.solr.find solr_doc_params(id, extra_controller_params)
raise InvalidSolrID.new if solr_response.docs.empty?
solr_response
document = SolrDocument.new(solr_response.docs.first)
[solr_response, document]
end

# returns a params hash for a single facet field solr query.
Expand Down

0 comments on commit 12f720e

Please sign in to comment.