Blacklight Plugin

Index actions use Mash's in views rather than SolrDocuments

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.4
  • Fix Version/s: 2.5
  • Component/s: None
  • Description:
    Hide
    The lib/blacklight/SolrHelper#get_search_results method returns an rsolr Response object, which is stored in @response.

    The catalog/_document_list.erb partial iterates over @response.docs to display result list, meaning it iterates over Mash objects.

    This means that Mash objects are also what's passed to it's sub-partials and it's called helper objects. Which means if a localizer wants to over-ride a helper method or partial, they're over-ridden code only has access to Mash objects, not full SolrDocument objects.

    It is preferable that this logic uses SolrDocument objects instead, for consistency and full access to SolrDocument conveniences.

    Proposed fix:

    Analogy to SolrHelper#get_solr_response_for_doc_id which now returns a duple of [rsolr_response_obj, solr_document]. Then the CatalogController method stores these in @response and @document respectively.

    So on that analogy, SolrHelper#get_search_results should return a duple of [rsolr_response, array_of_solr_documents]. The relevant CatalogController method(s) should store these in @response and @document_list respectively. The _document_list partial should iterate over @document_list rather than @response.docs.

    I will prepare a patch implementing this and send a pull request. Please do let me know if you think this is the wrong strategy.
    Show
    The lib/blacklight/SolrHelper#get_search_results method returns an rsolr Response object, which is stored in @response. The catalog/_document_list.erb partial iterates over @response.docs to display result list, meaning it iterates over Mash objects. This means that Mash objects are also what's passed to it's sub-partials and it's called helper objects. Which means if a localizer wants to over-ride a helper method or partial, they're over-ridden code only has access to Mash objects, not full SolrDocument objects. It is preferable that this logic uses SolrDocument objects instead, for consistency and full access to SolrDocument conveniences. Proposed fix: Analogy to SolrHelper#get_solr_response_for_doc_id which now returns a duple of [rsolr_response_obj, solr_document]. Then the CatalogController method stores these in @response and @document respectively. So on that analogy, SolrHelper#get_search_results should return a duple of [rsolr_response, array_of_solr_documents]. The relevant CatalogController method(s) should store these in @response and @document_list respectively. The _document_list partial should iterate over @document_list rather than @response.docs. I will prepare a patch implementing this and send a pull request. Please do let me know if you think this is the wrong strategy.

Activity

Hide
Jonathan Rochkind added a comment - 02/Dec/09 12:45 PM
Pull request wtih patch sent.
Show
Jonathan Rochkind added a comment - 02/Dec/09 12:45 PM Pull request wtih patch sent.

People

Dates

  • Created:
    01/Dec/09 12:12 PM
    Updated:
    08/Jan/10 2:25 PM
    Resolved:
    08/Jan/10 2:25 PM