Skip to content

Commit

Permalink
open AdminSetSearchBuilder to post-Wings model scope
Browse files Browse the repository at this point in the history
this search builder should find objects of class `AdminSet` and
`Hyrax::AdministrativeSet`. with Wings enabled, `AdministrativeSet` already
resolves its `internal_resource` as `AdminSet`. for apps without wings, its
desirable for this service to find objects indexed with `has_model_ssim` of
`Hyrax::AdministrativeSet`.

maybe we also want to move this builder toward using the "generic type" index?
that would require a broad reindex from downstream apps, because the legacy
admin sets don't seem to include any generic type data.
  • Loading branch information
tamsin johnson authored and dunn committed Jul 26, 2021
1 parent 4be5966 commit 4efa6b8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/search_builders/hyrax/admin_set_search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def initialize(context, access)

# This overrides the models in FilterByType
def models
[::AdminSet]
[::AdminSet, Hyrax::AdministrativeSet]
end

# Overrides Hydra::AccessControlsEnforcement
Expand Down
2 changes: 1 addition & 1 deletion app/search_builders/hyrax/my/collections_search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ def show_only_collections_deposited_by_current_user(solr_parameters)
# This overrides the models in FilterByType
# @return [Array<Class>] a list of classes to include
def models
[::AdminSet, ::Collection]
[::AdminSet, ::Collection, Hyrax::AdministrativeSet]
end
end
4 changes: 2 additions & 2 deletions spec/search_builders/hyrax/admin_set_search_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
expect(subject['fq']).to eq ["edit_access_person_ssim:#{user.user_key} OR " \
"discover_access_person_ssim:#{user.user_key} OR " \
"read_access_person_ssim:#{user.user_key}",
"{!terms f=has_model_ssim}AdminSet"]
"{!terms f=has_model_ssim}AdminSet,Hyrax::AdministrativeSet"]
end
end

Expand All @@ -72,7 +72,7 @@
end

it 'is successful' do
expect(subject['fq']).to eq ["{!terms f=id}7,8", "{!terms f=has_model_ssim}AdminSet"]
expect(subject['fq']).to eq ["{!terms f=id}7,8", "{!terms f=has_model_ssim}AdminSet,Hyrax::AdministrativeSet"]
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
describe '#models' do
subject { builder.models }

it { is_expected.to eq([AdminSet, Collection]) }
it { is_expected.to eq([AdminSet, Collection, Hyrax::AdministrativeSet]) }
end

describe ".default_processor_chain" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

it do
is_expected.to match_array ["",
"{!terms f=has_model_ssim}AdminSet"]
"{!terms f=has_model_ssim}AdminSet,Hyrax::AdministrativeSet"]
end
end
end

0 comments on commit 4efa6b8

Please sign in to comment.