Module: Ddr::Models::Indexing
Constant Summary
Index::Fields::ACCESS_ROLE, Index::Fields::ACTIVE_FEDORA_MODEL, Index::Fields::ADMIN_SET, Index::Fields::ADMIN_SET_FACET, Index::Fields::ALL_TEXT, Index::Fields::ASPACE_ID, Index::Fields::ATTACHED_FILES, Index::Fields::ATTACHED_FILES_HAVING_CONTENT, Index::Fields::BOX_NUMBER_FACET, Index::Fields::COLLECTION_FACET, Index::Fields::COLLECTION_URI, Index::Fields::CONTENT_CREATE_DATE, Index::Fields::CONTENT_SIZE, Index::Fields::CONTENT_SIZE_HUMAN, Index::Fields::CONTRIBUTOR_FACET, Index::Fields::CREATOR_FACET, Index::Fields::DATE_FACET, Index::Fields::DATE_SORT, Index::Fields::DEPOSITOR, Index::Fields::DISPLAY_FORMAT, Index::Fields::DOI, Index::Fields::EAD_ID, Index::Fields::EXTRACTED_TEXT, Index::Fields::FCREPO3_PID, Index::Fields::FORMAT_FACET, Index::Fields::HAS_MODEL, Index::Fields::ID, Index::Fields::IDENTIFIER_ALL, Index::Fields::IS_ATTACHED_TO, Index::Fields::IS_EXTERNAL_TARGET_FOR, Index::Fields::IS_GOVERNED_BY, Index::Fields::IS_LOCKED, Index::Fields::IS_MEMBER_OF_COLLECTION, Index::Fields::IS_PART_OF, Index::Fields::LAST_FIXITY_CHECK_ON, Index::Fields::LAST_FIXITY_CHECK_OUTCOME, Index::Fields::LAST_VIRUS_CHECK_ON, Index::Fields::LAST_VIRUS_CHECK_OUTCOME, Index::Fields::LICENSE, Index::Fields::LOCAL_ID, Index::Fields::MEDIA_MAJOR_TYPE, Index::Fields::MEDIA_SUB_TYPE, Index::Fields::MEDIA_TYPE, Index::Fields::MULTIRES_IMAGE_FILE_PATH, Index::Fields::OBJECT_CREATE_DATE, Index::Fields::OBJECT_MODIFIED_DATE, Index::Fields::OBJECT_PROFILE, Index::Fields::OBJECT_STATE, Index::Fields::ORIGINAL_FILENAME, Index::Fields::PERMANENT_ID, Index::Fields::PERMANENT_URL, Index::Fields::POLICY_ROLE, Index::Fields::PUBLISHER_FACET, Index::Fields::RESEARCH_HELP_CONTACT, Index::Fields::RESOURCE_ROLE, Index::Fields::SERIES_FACET, Index::Fields::SPATIAL_FACET, Index::Fields::STRUCT_MAPS, Index::Fields::SUBJECT_FACET, Index::Fields::TECHMD_COLOR_SPACE, Index::Fields::TECHMD_CREATING_APPLICATION, Index::Fields::TECHMD_CREATION_TIME, Index::Fields::TECHMD_FILE_SIZE, Index::Fields::TECHMD_FITS_DATETIME, Index::Fields::TECHMD_FITS_VERSION, Index::Fields::TECHMD_FORMAT_LABEL, Index::Fields::TECHMD_FORMAT_VERSION, Index::Fields::TECHMD_IMAGE_HEIGHT, Index::Fields::TECHMD_IMAGE_WIDTH, Index::Fields::TECHMD_MEDIA_TYPE, Index::Fields::TECHMD_MESSAGE, Index::Fields::TECHMD_MODIFICATION_TIME, Index::Fields::TECHMD_PRONOM_IDENTIFIER, Index::Fields::TECHMD_VALID, Index::Fields::TECHMD_WELL_FORMED, Index::Fields::TITLE, Index::Fields::TYPE_FACET, Index::Fields::UNIQUE_ID, Index::Fields::WORKFLOW_STATE, Index::Fields::YEAR_FACET
Class Method Summary
collapse
Instance Method Summary
collapse
descmd, get, techmd
Class Method Details
.const_missing(name) ⇒ Object
Instance Method Details
#admin_set_facet ⇒ Object
112
113
114
115
116
117
118
|
# File 'lib/ddr/models/indexing.rb', line 112
def admin_set_facet
if admin_set.present?
admin_set
elsif associated_collection.present?
associated_collection.admin_set
end
end
|
#all_identifiers ⇒ Object
104
105
106
|
# File 'lib/ddr/models/indexing.rb', line 104
def all_identifiers
desc_metadata.identifier + [fcrepo3_pid, local_id, permanent_id, id].compact
end
|
#associated_collection ⇒ Object
108
109
110
|
# File 'lib/ddr/models/indexing.rb', line 108
def associated_collection
admin_policy
end
|
#collection_facet ⇒ Object
120
121
122
|
# File 'lib/ddr/models/indexing.rb', line 120
def collection_facet
associated_collection.id if associated_collection.present?
end
|
#date_sort ⇒ Object
124
125
126
|
# File 'lib/ddr/models/indexing.rb', line 124
def date_sort
desc_metadata.date.first
end
|
#index_fields ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/ddr/models/indexing.rb', line 18
def index_fields
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.contributor,
CREATOR_FACET => desc_metadata.creator,
DATE_FACET => desc_metadata.date,
ATTACHED_FILES_HAVING_CONTENT => attached_files_having_content.keys,
DATE_SORT => date_sort,
DEPOSITOR => depositor,
DISPLAY_FORMAT => display_format,
DOI => doi,
EAD_ID => ead_id,
FCREPO3_PID => fcrepo3_pid,
FORMAT_FACET => desc_metadata.format,
IDENTIFIER_ALL => all_identifiers,
IS_LOCKED => is_locked,
LICENSE => license,
LOCAL_ID => local_id,
PERMANENT_ID => permanent_id,
PERMANENT_URL => permanent_url,
POLICY_ROLE => roles.in_policy_scope.agents,
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.subject,
TITLE => title_display,
TYPE_FACET => desc_metadata.type,
UNIQUE_ID => unique_ids,
WORKFLOW_STATE => workflow_state,
YEAR_FACET => year_facet,
}
if respond_to? :fixity_checks
last_fixity_check = fixity_checks.last
fields.merge!(last_fixity_check.to_solr) if last_fixity_check
end
if respond_to? :virus_checks
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
fields.merge! techmd.index_fields
end
if has_multires_image?
fields[MULTIRES_IMAGE_FILE_PATH] = multires_image_file_path
end
if has_struct_metadata?
fields[STRUCT_MAPS] = structure.struct_maps.to_json
end
if
fields[EXTRACTED_TEXT] = .content
end
if is_a? Component
fields[COLLECTION_URI] = collection_id
end
if is_a? Collection
fields[ADMIN_SET_FACET] = admin_set_facet
fields[COLLECTION_FACET] = collection_facet
end
if is_a? Item
fields[ADMIN_SET_FACET] = admin_set_facet
fields[COLLECTION_FACET] = collection_facet
fields[ALL_TEXT] = all_text
end
fields
end
|
#title_display ⇒ Object
97
98
99
100
101
102
|
# File 'lib/ddr/models/indexing.rb', line 97
def title_display
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?
"[#{id}]"
end
|
#to_solr(solr_doc = Hash.new, opts = {}) ⇒ Object
13
14
15
16
|
# File 'lib/ddr/models/indexing.rb', line 13
def to_solr(solr_doc=Hash.new, opts={})
solr_doc = super(solr_doc, opts)
solr_doc.merge index_fields
end
|
#year_facet ⇒ Object
128
129
130
|
# File 'lib/ddr/models/indexing.rb', line 128
def year_facet
YearFacet.call(self)
end
|