Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index member_of_collection_ids for PcdmCollection #5852

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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