Skip to content
Jeremy Friesen edited this page Aug 16, 2022 · 6 revisions

Spotlight uses your application's base Blacklight configuration to provide default values for an exhibit. Each exhibit gets its own copy of the base Blacklight configuration that it can modify (through the administrative interface) that does not affect the application's base (or any other exhibit's) configuration. The Blacklight configuration options are documented on the Blacklight wiki.

Spotlight requires a field to sort by last updated time. You can specify this in blacklight_config.index.timestamp_field. If you don't provide one, Spotlight will default to timestamp.

Spotlight also uses a field to mark records public. Spotlight::SolrDocument.visibility_field(exhibit) is the default.

Spotlight uses the hash provided by Spotlight::Exhibit.solr_data as filters to determine which objects show in the current exhibit.

Spotlight stores tags in the field Spotlight::SolrDocument.solr_field_for_tagger(tagger)

Discovery experience

Blacklight provides extensive configuration options, available in your application's CatalogController. Spotlight uses the Blacklight configuration to provide the curator with a set of options that can be selected on an exhibit-specific bases.

Blacklight's sort, items per page, and search field configurations are documented on the [Blacklight wiki] (https://github.com/projectblacklight/blacklight/wiki/Configuration---Solr-fields).

Metadata Fields

Out-of-the-box, Spotlight is configured to support only the Solr fields required by exhibits (i.e. uploaded fields, exhibit-custom fields, and some spotlight administrative fields). If you want to use Spotlight with data indexed from outside Spotlight, you will need to update your CatalogController results view configuration for index and show fields.

Spotlight will populate the curator's list of available metadata fields using the CatalogController configuration. If the curator has already made configuration choices, these fields will be hidden in the search results view by default, and must be enabled from the Curation > Metadata Fields page.

Spotlight::UploadFieldConfig and Blacklight Configuration

When using the Spotlight::UploadFieldConfig accepts a blacklight_options parameter. The blacklight_options are passed to the Blacklight::Configuration#add_index_field. In other words, you can use those blacklight_options to provide common configuration.

Spotlight::Engine.config.upload_fields = [
  Spotlight::UploadFieldConfig.new(
    field_name: :spotlight_upload_description_tesim,
    # Only render this field for actions named "show".  Which is by default
    # showing a singular item, not the index/search page for items.
    blacklight_options: { if: ->(context, *args) { context.action_name == "show" } },
    label: -> { I18n.t(:'spotlight.search.fields.spotlight_upload_description_tesim') },
    form_field_type: :text_area
  )
]

See Blacklight's Configuration Results View wiki page for more details on what can be provided in the blacklight_options Hash.

Facet fields

The default Spotlight configuration only shows "controlled vocabulary" metadata fields and Spotlight administrative facets (e.g. tags and visibility). To add additional facets or change the facet behavior, you should update your CatalogController configuration to add the appropriate facet fields.