Issue Details (XML | Word | Printable)

Key: CODEBASE-196
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Bess Sadler
Reporter: Jonathan Rochkind
Votes: 0
Watchers: 0
Operations

Clone this issue
If you were logged in you would be able to see more operations.
Blacklight Plugin

Index actions use Mash's in views rather than SolrDocuments

Created: 01/Dec/09 12:12 PM   Updated: 08/Jan/10 02:25 PM
Return to search
Component/s: None
Affects Version/s: 2.4
Fix Version/s: 2.5


 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.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Jonathan Rochkind added a comment - 02/Dec/09 12:45 PM
Pull request wtih patch sent.