Skip to content

Commit

Permalink
Update default Solr field selections
Browse files Browse the repository at this point in the history
  • Loading branch information
DanOlson committed Aug 19, 2024
1 parent cfc30a8 commit 33900d7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
5 changes: 4 additions & 1 deletion app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,10 @@ def parse_referrer_pagination_params(query_string)
config.add_index_field 'type_tesi', label: 'Type', highlight: true
config.add_index_field 'physical_format_tesi', label: 'Format', highlight: true

field_list = 'id,title_tesi,' + config.index_fields.keys.join(',')
field_list = 'id,title_tesi,timestamp,identifier_ssim,' +
SolrDocument::OAI_FIELDS.join(',') +
',' +
config.index_fields.keys.join(',')
# Default parameters to send to solr for all search-like requests.
config.default_solr_params = {
rows: 20,
Expand Down
42 changes: 25 additions & 17 deletions app/models/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ class SolrDocument
MDL_ITEM_URL_FIELD = 'mdl_item_url'.freeze
private_constant :MDL_ITEM_URL_FIELD

MDL_FIELD_SEMANTICS = {
creator: 'creator_tesi',
date: 'dat_ssi',
subject: ['subject_ssim', 'keyword_tesi'],
title: 'title_ssi',
coverage: ['city_ssim', 'county_ssim', 'state_ssi', 'country_ssi', 'geonam_ssi'],
language: 'language_ssi',
format: ['physical_format_tesi', 'dimensions_ssi'],
type: 'type_ssi',
description: 'description_ts',
source: 'publishing_agency_ssi',
relation: ['topic_ssim', 'collection_name_ssi'],
publisher: 'contributing_organization_ssi',
rights: ['rights_ssi', 'rights_uri_ssi', 'rights_status_ssi', 'rights_statement_ssi'],
identifier: [MDL_ITEM_URL_FIELD, 'local_identifier_ssi', 'identifier_ssi']
}.freeze
private_constant :MDL_FIELD_SEMANTICS

OAI_FIELDS = (['oai_set_ssi'] + MDL_FIELD_SEMANTICS
.values
.flat_map(&:itself))
.freeze

# self.unique_key = 'id'

# Email uses the semantic field mappings below to generate the body of an email.
Expand All @@ -24,27 +47,12 @@ class SolrDocument
# single valued. See Blacklight::Document::SemanticFields#field_semantics
# and Blacklight::Document::SemanticFields#to_semantic_values
# Recommendation: Use field names from Dublin Core
use_extension( Blacklight::Document::DublinCore)
use_extension(Blacklight::Document::DublinCore)

###
# These define the metadata that's returned for each record
# when calling the OAI GetRecord verb
field_semantics.merge!(
creator: 'creator_tesi',
date: 'dat_ssi',
subject: ['subject_ssim', 'keyword_tesi'],
title: 'title_ssi',
coverage: ['city_ssim', 'county_ssim', 'state_ssi', 'country_ssi', 'geonam_ssi'],
language: 'language_ssi',
format: ['physical_format_tesi', 'dimensions_ssi'],
type: 'type_ssi',
description: 'description_ts',
source: 'publishing_agency_ssi',
relation: ['topic_ssim', 'collection_name_ssi'],
publisher: 'contributing_organization_ssi',
rights: ['rights_ssi', 'rights_uri_ssi', 'rights_status_ssi', 'rights_statement_ssi'],
identifier: [MDL_ITEM_URL_FIELD, 'local_identifier_ssi', 'identifier_ssi']
)
field_semantics.merge!(MDL_FIELD_SEMANTICS)

# @!attribute [r] contributing_organization
# @return [String]
Expand Down

0 comments on commit 33900d7

Please sign in to comment.