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

🎁 make facet options match adventist-dl proper #104

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Changes from 2 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
28 changes: 20 additions & 8 deletions app/controllers/catalog_controller_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@

CatalogController.include DogBiscuits::Blacklight::Commands

def delete_default_facet_fields(config)
default_facet_field_keys = CatalogController.configure_blacklight.facet_fields.keys
ShanaLMoore marked this conversation as resolved.
Show resolved Hide resolved
default_facet_field_keys.each do |key|
config.facet_fields.delete(key)
end
end

CatalogController.configure_blacklight do |config|
# Use locally customized AdvSearchBuilder so we can enable blacklight_advanced_search
config.search_builder_class = AdvSearchBuilder

# Delete Hyku's default settings
ShanaLMoore marked this conversation as resolved.
Show resolved Hide resolved
delete_default_facet_fields(config)

# solr fields that will be treated as facets by the blacklight application
# The ordering of the field names is the order of the display
config.add_facet_field 'source_sim', label: 'Source', limit: 5, collapse: false, helper_method: :iconify_auto_link
config.add_facet_field 'human_readable_type_sim', label: "Type", limit: 5, collapse: false
config.add_facet_field(
'sorted_year_isi',
label: 'Date Range',
Expand All @@ -22,17 +33,18 @@
},
facet_field_label: 'Date Range'
)

# Delete Hyku version so we can add the Author label
config.facet_fields.delete('creator_sim')
config.add_facet_field 'resource_type_sim', label: "Resource Type", limit: 5
config.add_facet_field 'creator_sim', label: "Author", limit: 5

# Delete default Hyku facets that are no applicable for this Knapsack
config.facet_fields.delete('contributor_sim')
config.facet_fields.delete('file_format_sim')

config.add_facet_field 'publisher_sim', limit: 5
config.add_facet_field 'keyword_sim', limit: 5
config.add_facet_field 'subject_sim', limit: 5
config.add_facet_field 'language_sim', limit: 5
config.add_facet_field 'based_near_label_sim', limit: 5
config.add_facet_field 'part_sim', limit: 5, label: 'Part'
config.add_facet_field 'part_of_sim', limit: 5
# config.add_facet_field 'file_format_sim', limit: 5
# config.add_facet_field 'contributor_sim', label: "Contributor", limit: 5
config.add_facet_field 'member_of_collections_ssim', limit: 5, label: 'Collections'
config.add_facet_field 'refereed_sim', limit: 5

# Clobber all existing index and show fields that come from Hyku base but skip
Expand Down