Skip to content

Instantly share code, notes, and snippets.

@jrochkind
Created September 22, 2011 22:19
Show Gist options
  • Save jrochkind/1236211 to your computer and use it in GitHub Desktop.
Save jrochkind/1236211 to your computer and use it in GitHub Desktop.
blacklight new config
self.blacklight_config.configure do
default_solr_params = { :qt => "search", :per_page => 10 }
# a couple weeks ago, we talked about trying to DRY these.
config.show.html_title = "title_display"
config.show.heading = "title_display"
config.show.display_type = "format"
# Under a better DSL, the above could look something like:
# config.show do
# html_title "title_display"
# heading "title_display"
# display_type "format"
# end
index.show_link = "title_display"
add_facet :field => 'format', :label => "Format", :limit => true
add_facet :field => 'subject_topic_facet', :label => "Topic", :limit => 20
# Alternately we _could_ provide a better DSL? How much benefit for cost of impleenting?
# add_facet do
# field = "format"
# label = "Format"
# etc.
# because these parameters are implemented using OpenStruct, the keys can are arbitrary
add_facet :field => 'pub_date', :label => "Publication Year", :template => "blacklight_range_limit_visualization", :begin => 1000, :end => 5000
add_index_field :field => "title_display", :label => "Title:"
add_show_field :field => "title_display", :label => "Title: "
add_search_field :key => ..., :solr_parameters => { ... }, :solr_local_parameters => { ... }
add_sort_field :label => "relevance", :sort => "score desc, pub_date_sort desc, title_sort asc"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment