Skip to content

Commit

Permalink
Index member_of_collection_ids for PcdmCollection
Browse files Browse the repository at this point in the history
Co-authored-by: Jose Blanco <blancoj@umich.edu>
  • Loading branch information
2 people authored and tamsin johnson committed Sep 12, 2022
1 parent 0539d4e commit 053de2d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/indexers/hyrax/pcdm_collection_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def to_solr
super.tap do |index_document|
index_document[Hyrax.config.collection_type_index_field.to_sym] = Array(resource.try(:collection_type_gid)&.to_s)
index_document[:generic_type_sim] = ['Collection']
index_document[:member_of_collection_ids_ssim] = resource.member_of_collection_ids.map(&:to_s)
index_document[:depositor_ssim] = [resource.depositor]
index_document[:depositor_tesim] = [resource.depositor]
end
Expand Down
5 changes: 5 additions & 0 deletions lib/hyrax/specs/shared_specs/indexers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@
.to include(generic_type_sim: a_collection_containing_exactly('Collection'))
end

it 'indexes member_of_collection_ids' do
expect(indexer.to_solr)
.to include(member_of_collection_ids_ssim: resource.member_of_collection_ids)
end

it 'indexes depositor' do
expect(indexer.to_solr)
.to include(depositor_ssim: [resource.depositor],
Expand Down
2 changes: 1 addition & 1 deletion spec/indexers/hyrax/pcdm_collection_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'hyrax/specs/shared_specs'

RSpec.describe Hyrax::PcdmCollectionIndexer do
let(:resource) { FactoryBot.valkyrie_create(:hyrax_collection) }
let(:resource) { FactoryBot.valkyrie_create(:hyrax_collection, :as_collection_member) }
let(:indexer_class) { described_class }

it_behaves_like 'a Collection indexer'
Expand Down

0 comments on commit 053de2d

Please sign in to comment.