Skip to content

Commit

Permalink
Merge pull request #416 from IU-Libraries-Joint-Development/essi-1598…
Browse files Browse the repository at this point in the history
…_indexing_based_near

[ESSI-1598] Restore hyrax based_near behavior allinson_flex overrides
  • Loading branch information
randalldfloyd authored Apr 6, 2022
2 parents 1146125 + 6098be0 commit e002756
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/archival_material.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ class ArchivalMaterial < ActiveFedora::Base
# schema (by adding accepts_nested_attributes)

include AllinsonFlex::DynamicMetadataBehavior
include ESSI::DynamicMetadataBehavior
include ::Hyrax::BasicMetadata
end
1 change: 1 addition & 0 deletions app/models/bib_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ class BibRecord < ActiveFedora::Base
# schema (by adding accepts_nested_attributes)

include AllinsonFlex::DynamicMetadataBehavior
include ESSI::DynamicMetadataBehavior
include ::Hyrax::BasicMetadata
end
18 changes: 18 additions & 0 deletions app/models/concerns/essi/dynamic_metadata_behavior.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

module ESSI
module DynamicMetadataBehavior
extend ActiveSupport::Concern

CUSTOM_PROPERTIES = { based_near: { class_name: Hyrax::ControlledVocabularies::Location } }.freeze

class_methods do
def late_add_property(name, properties)
if CUSTOM_PROPERTIES.keys.include?(name)
properties = CUSTOM_PROPERTIES[name].merge(properties)
end
super(name, properties)
end
end
end
end
1 change: 1 addition & 0 deletions app/models/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ class Image < ActiveFedora::Base
# This must be included at the end, because it finalizes the metadata
# schema (by adding accepts_nested_attributes)
include AllinsonFlex::DynamicMetadataBehavior
include ESSI::DynamicMetadataBehavior
include ::Hyrax::BasicMetadata
end
1 change: 1 addition & 0 deletions app/models/paged_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ class PagedResource < ActiveFedora::Base
# schema (by adding accepts_nested_attributes)

include AllinsonFlex::DynamicMetadataBehavior
include ESSI::DynamicMetadataBehavior
include ::Hyrax::BasicMetadata
end
2 changes: 1 addition & 1 deletion app/models/scientific.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ class Scientific < ActiveFedora::Base
# schema (by adding accepts_nested_attributes)

include AllinsonFlex::DynamicMetadataBehavior
include ESSI::DynamicMetadataBehavior
include ::Hyrax::BasicMetadata

end
2 changes: 2 additions & 0 deletions app/services/allinson_flex/dynamic_schema_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def initialize(admin_set_id:, work_class_name:, dynamic_schema_id: nil)

# @return [Hash] property => array of indexing
# modified for essi to exclude modifier values like admin_only
# modified for essi to exclude :based_near
def indexing_properties
indexers = {}
properties.each_pair do |prop_name, prop_value|
Expand All @@ -94,6 +95,7 @@ def indexing_properties
end.compact.uniq
end
end
indexers.delete(:based_near)
indexers[:profile_version] = ['profile_version_ssi']
indexers[:dynamic_schema_id] = ['dynamic_schema_id_ssi']
indexers
Expand Down

0 comments on commit e002756

Please sign in to comment.