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.