lib/ddr/models/indexing.rb in ddr-models-3.0.0.beta.4 vs lib/ddr/models/indexing.rb in ddr-models-3.0.0.beta.6

- old
+ new

@@ -1,5 +1,7 @@ +require 'time' + module Ddr module Models module Indexing include Ddr::Index::Fields @@ -17,14 +19,14 @@ fields = { ACCESS_ROLE => roles.to_json, ADMIN_SET => admin_set, ASPACE_ID => aspace_id, ATTACHED_FILES => attached_files_profile.to_json, - BOX_NUMBER_FACET => desc_metadata_values('box_number'), - CONTRIBUTOR_FACET => desc_metadata_values('contributor'), - CREATOR_FACET => descMetadata.creator, - DATE_FACET => descMetadata.date, + BOX_NUMBER_FACET => desc_metadata.values('box_number'), + CONTRIBUTOR_FACET => desc_metadata.values('contributor'), + CREATOR_FACET => desc_metadata.creator, + DATE_FACET => desc_metadata.date, DATE_SORT => date_sort, DEPOSITOR => depositor, DISPLAY_FORMAT => display_format, DOI => doi, EAD_ID => ead_id, @@ -33,18 +35,18 @@ LICENSE => license, LOCAL_ID => local_id, PERMANENT_ID => permanent_id, PERMANENT_URL => permanent_url, POLICY_ROLE => roles.in_policy_scope.agents, - PUBLISHER_FACET => descMetadata.publisher, + PUBLISHER_FACET => desc_metadata.publisher, RESEARCH_HELP_CONTACT => research_help_contact, RESOURCE_ROLE => roles.in_resource_scope.agents, - SERIES_FACET => desc_metadata_values('series'), - SPATIAL_FACET => desc_metadata_values('spatial'), - SUBJECT_FACET => desc_metadata_values('subject'), + SERIES_FACET => desc_metadata.values('series'), + SPATIAL_FACET => desc_metadata.values('spatial'), + SUBJECT_FACET => desc_metadata.values('subject'), TITLE => title_display, - TYPE_FACET => descMetadata.type, + TYPE_FACET => desc_metadata.type, WORKFLOW_STATE => workflow_state, YEAR_FACET => year_facet, } if respond_to? :fixity_checks last_fixity_check = fixity_checks.last @@ -54,10 +56,11 @@ last_virus_check = virus_checks.last fields.merge!(last_virus_check.to_solr) if last_virus_check end if has_content? fields[ORIGINAL_FILENAME] = original_filename + fields[CONTENT_CREATE_DATE] = Ddr::Utils.solr_date(content.create_date) fields[CONTENT_SIZE] = content_size fields[CONTENT_SIZE_HUMAN] = content_human_size fields[MEDIA_TYPE] = content_type fields[MEDIA_MAJOR_TYPE] = content_major_type fields[MEDIA_SUB_TYPE] = content_sub_type @@ -85,18 +88,18 @@ end fields end def title_display - return descMetadata.title.first if descMetadata.title.present? - return descMetadata.identifier.first if descMetadata.identifier.present? + return desc_metadata.title.first if desc_metadata.title.present? + return desc_metadata.identifier.first if desc_metadata.identifier.present? return original_filename if respond_to?(:original_filename) && original_filename.present? - "[#{pid}]" + "[#{id}]" end def all_identifiers - descMetadata.identifier + [local_id, permanent_id, pid].compact + desc_metadata.identifier + [local_id, permanent_id, id].compact end def associated_collection admin_policy end @@ -112,10 +115,10 @@ def collection_facet associated_collection.id if associated_collection.present? end def date_sort - descMetadata.date.first + desc_metadata.date.first end def year_facet YearFacet.call(self) end