Skip to content

Commit

Permalink
Load the indexer module for flexible metadata
Browse files Browse the repository at this point in the history
Configures dassie, koppie, hyrax app, and generators for flexible
metadata indexing to occur.
  • Loading branch information
laritakr committed Jun 27, 2024
1 parent c052bbb commit 857f579
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .dassie/app/indexers/collection_resource_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Generated via
# `rails generate hyrax:collection_resource CollectionResource`
class CollectionResourceIndexer < Hyrax::PcdmCollectionIndexer
include Hyrax::Indexer(:basic_metadata)
include Hyrax::Indexer(:collection_resource)
include Hyrax::Indexer(:basic_metadata) unless Hyrax.config.flexible?
include Hyrax::Indexer(:collection_resource) unless Hyrax.config.flexible?
include Hyrax::Indexer('CollectionResource') if Hyrax.config.flexible?
end
1 change: 1 addition & 0 deletions .dassie/app/indexers/generic_work_resource_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class GenericWorkResourceIndexer < Hyrax::ValkyrieWorkIndexer
include Hyrax::Indexer(:basic_metadata) unless Hyrax.config.flexible?
include Hyrax::Indexer(:generic_work_resource) unless Hyrax.config.flexible?
include Hyrax::Indexer('GenericWorkResource') if Hyrax.config.flexible?

# Uncomment this block if you want to add custom indexing behavior:
# def to_solr
Expand Down
5 changes: 3 additions & 2 deletions .dassie/app/indexers/monograph_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# Generated via
# `rails generate hyrax:work_resource Monograph`
class MonographIndexer < Hyrax::ValkyrieWorkIndexer
include Hyrax::Indexer(:basic_metadata)
include Hyrax::Indexer(:monograph)
include Hyrax::Indexer(:basic_metadata) unless Hyrax.config.flexible?
include Hyrax::Indexer(:monograph) unless Hyrax.config.flexible?
include Hyrax::Indexer('Monograph') if Hyrax.config.flexible?

# Uncomment this block if you want to add custom indexing behavior:
# def to_solr
Expand Down
5 changes: 3 additions & 2 deletions .koppie/app/indexers/collection_resource_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Generated via
# `rails generate hyrax:collection_resource CollectionResource`
class CollectionResourceIndexer < Hyrax::PcdmCollectionIndexer
include Hyrax::Indexer(:basic_metadata)
include Hyrax::Indexer(:collection_resource)
include Hyrax::Indexer(:basic_metadata) unless Hyrax.config.flexible?
include Hyrax::Indexer(:collection_resource) unless Hyrax.config.flexible?
include Hyrax::Indexer('CollectionResource') if Hyrax.config.flexible?
end
5 changes: 3 additions & 2 deletions .koppie/app/indexers/generic_work_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# Generated via
# `rails generate hyrax:work_resource GenericWork`
class GenericWorkIndexer < Hyrax::ValkyrieWorkIndexer
include Hyrax::Indexer(:basic_metadata)
include Hyrax::Indexer(:generic_work)
include Hyrax::Indexer(:basic_metadata) unless Hyrax.config.flexible?
include Hyrax::Indexer(:generic_work) unless Hyrax.config.flexible?
include Hyrax::Indexer('GenericWork') if Hyrax.config.flexible?

# Uncomment this block if you want to add custom indexing behavior:
# def to_solr
Expand Down
5 changes: 3 additions & 2 deletions .koppie/app/indexers/monograph_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# Generated via
# `rails generate hyrax:work_resource Monograph`
class MonographIndexer < Hyrax::ValkyrieWorkIndexer
include Hyrax::Indexer(:basic_metadata)
include Hyrax::Indexer(:monograph)
include Hyrax::Indexer(:basic_metadata) unless Hyrax.config.flexible?
include Hyrax::Indexer(:monograph) unless Hyrax.config.flexible?
include Hyrax::Indexer('Monograph') if Hyrax.config.flexible?

# Uncomment this block if you want to add custom indexing behavior:
# def to_solr
Expand Down
1 change: 1 addition & 0 deletions app/indexers/hyrax/indexers/administrative_set_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class AdministrativeSetIndexer < Hyrax::Indexers::ResourceIndexer
include Hyrax::PermissionIndexer
include Hyrax::VisibilityIndexer
include Hyrax::Indexer(:core_metadata) unless Hyrax.config.flexible?
include Hyrax::Indexer('Hyrax::AdministrativeSet') if Hyrax.config.flexible?

def to_solr # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
super.tap do |solr_doc|
Expand Down
1 change: 1 addition & 0 deletions app/indexers/hyrax/indexers/file_set_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class FileSetIndexer < Hyrax::Indexers::ResourceIndexer # rubocop:disable Metric
include Hyrax::ThumbnailIndexer
include Hyrax::Indexer(:core_metadata) unless Hyrax.config.flexible?
include Hyrax::Indexer(:file_set_metadata) unless Hyrax.config.flexible?
include Hyrax::Indexer('Hyrax::FileSet') if Hyrax.config.flexible?

def to_solr # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
super.tap do |solr_doc| # rubocop:disable Metrics/BlockLength
Expand Down
1 change: 1 addition & 0 deletions app/indexers/hyrax/indexers/pcdm_collection_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class PcdmCollectionIndexer < Hyrax::Indexers::ResourceIndexer
include Hyrax::LocationIndexer
include Hyrax::ThumbnailIndexer
include Hyrax::Indexer(:core_metadata) unless Hyrax.config.flexible?
include Hyrax::Indexer('Hyrax::PcdmCollection') if Hyrax.config.flexible?

self.thumbnail_path_service = CollectionThumbnailPathService

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
# `rails generate hyrax:collection_resource <%= class_name %>`
class <%= class_name %>Indexer < Hyrax::Indexers::PcdmCollectionIndexer
include Hyrax::Indexer(:<%= file_name %>) unless Hyrax.config.flexible?
include Hyrax::Indexer('<%= class_name %>') if Hyrax.config.flexible?
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class <%= class_name %>Indexer < Hyrax::Indexers::PcdmObjectIndexer(<%= class_name %>)
include Hyrax::Indexer(:basic_metadata) unless Hyrax.config.flexible?
include Hyrax::Indexer(:<%= file_name %>) unless Hyrax.config.flexible?
include Hyrax::Indexer('<%= class_name %>') if Hyrax.config.flexible?

# Uncomment this block if you want to add custom indexing behavior:
# def to_solr
Expand Down
1 change: 1 addition & 0 deletions lib/hyrax/indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def initialize(rules)
Hyrax::Schema.default_schema_loader.index_rules_for(schema: resource.class.to_s, version: resource.schema_version).each do |index_key, method|
document[index_key] = resource.try(method)
end
document['schema_version_ssi'] = resource.schema_version
else
rules.each do |index_key, method|
document[index_key] = resource.try(method)
Expand Down

0 comments on commit 857f579

Please sign in to comment.