Module: Hyrax::Indexers::RedirectsIndexer
- Included in:
- PcdmCollectionIndexer, PcdmObjectIndexer
- Defined in:
- app/indexers/hyrax/indexers/redirects_indexer.rb
Overview
Indexer mixin that emits the redirects_path_tesim Solr field for
resources that carry a redirects attribute. The field is consumed
by the show-page renderer via SolrDocument#redirects_path.
Instance Method Summary collapse
Instance Method Details
#to_solr(*args) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/indexers/hyrax/indexers/redirects_indexer.rb', line 15 def to_solr(*args) super.tap do |document| next document unless Hyrax.config.redirects_active? next document unless resource.respond_to?(:redirects) # Valkyrie's JSONValueMapper symbolizes hash keys on read; accept either. # Paths are normalized at write time by Hyrax::RedirectsNormalization. paths = Array(resource.redirects) .map { |entry| entry['path'] || entry[:path] } .reject(&:blank?) document['redirects_path_tesim'] = paths end end |