[Blacklight-development] refactoring for solr_helper - done?

Naomi Dushay ndushay at stanford.edu
Mon Mar 16 11:46:33 EDT 2009


I just committed the changes I've been working on.   Main thrusts:

1.  abstract out the solr request concepts;  hide solr parameter  
details in solr_helper class, used by controllers as necessary
2.  stop hardcoding solr field names to views;  abstract them with  
solr.yml   and  display_fields class (see below)
    DO NOT  hardcode solr field names, or the code will be brittle and  
annoying to get working with site indexes.
3.  use document request handler (not details) when doing single  
document requests
***  note that the "prev" and "next" buttons use the search handler. "

All changes are in the plugin, except

*  solrconfig.xml   <--- added document request handler   (no need to  
reindex - just restart solr)
* solr.yml  (via solr.example)  this is where the mapping of solr  
fields to abstract names occurs

So, you should be able to get these updates working for you in three  

1.  svn update
2.  update solr.yml  file in your rails app    (restart rails app)
3.  update solrconfig.xml  in your solr instance   (restart solr)

Plugin changes:

*    init.rb    modified to include display_fields

*    blacklight.rb           <--  added document  request handler
*    display_fields.rb  added     <-- assigns display info from  
solr.yml to variables

.../app/controller     <-- removed hardcoded solr field names,  use  
*    catalog
*    home

.../app/helper  <-- removed hardcoded solr field names
*    catalog
*    solr_helper    <--  THE STAR OF THE SHOW

.../app/views/catalog   <-- removed hardcoded solr field names
*    _document_list  partial
*    show_index


*  catalog_controller:  major changes;  it should be less brittle now
*  home_controller:  reworked;  less brittle
*  view/catalog/show:  reworked and expanded, less brittle

added 2 specs
*  solr_helper
*  catalog/_document_list

Did NOT do:

1.  index.rss :  I'm guessing this will be site specific, and will  
also involve enough fields used only for this purpose as to be silly  
for solr.yml

2.  README updates:   will be coming along soon.

3.   giant purge of vestigial  facet action from catalog_controller,  
and other  related vestigial code.   I took some of it out, but wasn't  

- Naomi
p.s.  it turns out that the world doesn't stop just because your  
coding hits a lot of snags

More information about the Blacklight-development mailing list