-
Notifications
You must be signed in to change notification settings - Fork 253
Configuration Results View
The Blacklight results views can
The index view is configured from your CatalogController's blacklight configuration. Here is a listing of the configuration parameters Blacklight uses and their default values:
configure_blacklight do |config|
...
config.index.title_field = unique_key
config.index.partials = [:index_header, :thumbnail, :index]
config.index.display_type_field = 'format'
config.index.group = false
...
endThe configuration keys are not limited or restricted, so plugins or applications that need additional index configuration may add additional parameters directly.
config.index.my_custom_parameters = "some value"The title field setting determines the Solr field that Blacklight will use to display the record title.
If you need additional customization (e.g. to concatenate two fields, etc), you can provide your own implementation of the #document_heading partial method, e.g.
module ApplicationHelper
def document_heading document = nil
document ||= @document
document.first(:main_title) + " - " + document.first(:sub_title)
end
end
You can configure the partials that Blacklight will assemble to display a search result.
By default, Blacklight will render these three basic partials when displaying a document. The partial names are a combination of two configuration settings. The base name of the partial is given by the partials setting. The suffix is based on the type of document given by the value of the display_type_field. If a partial is not found with the given display_type_field value, it will attempt to render a default version of the base partial. If no matching partial is found, nothing will be displayed for that document.
For example, using the default values and a document without a format field, these partials will be rendered:
-
index_header_default.html.erb: The document title and document actions -
thumbnail_default.html.erb: A representative thumbnail (from thethumbnail_fieldconfiguration below) -
index_default.html.erb: A list of document fields
However, if the document had a format field with the value book, Blacklight would attempt to render these partials:
-
index_header_book.html.erb; if that doesn't exist, it will fall back toindex_header_default.html.erb -
thumbnail_book.html.erb; fall back tothumbnail_default.html.erb -
index_book.html.erb; fall back toindex_default.html.erb
Blacklight only provides default partials for these three base partials. If you were to provide an app/views/catalog/_index_book.html.erb partial, Blacklight would render that partial instead of the default.
Blacklight can use Solr's result collapsing feature. To use this feature, set the group parameter to the name of the field that Blacklight should use to render collapsed result sets.
Blacklight provides a default "list" view of results.

