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::ADMIN_SET_TITLE, Index::Fields::ALL_TEXT, Index::Fields::ASPACE_ID, Index::Fields::ATTACHED_FILES_HAVING_CONTENT, Index::Fields::BOX_NUMBER_FACET, Index::Fields::CATEGORY_FACET, Index::Fields::COLLECTION_FACET, Index::Fields::COLLECTION_TITLE, Index::Fields::COLLECTION_URI, Index::Fields::COMPANY_FACET, Index::Fields::CONTENT_CONTROL_GROUP, 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::FOLDER_FACET, Index::Fields::FORMAT_FACET, Index::Fields::HAS_MODEL, Index::Fields::ID, Index::Fields::IDENTIFIER_ALL, Index::Fields::INTERNAL_URI, 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, 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::MEDIUM_FACET, 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::PERMANENT_ID, Index::Fields::PERMANENT_URL, Index::Fields::PLACEMENT_COMPANY_FACET, Index::Fields::POLICY_ROLE, Index::Fields::PRODUCT_FACET, Index::Fields::PUBLICATION_FACET, Index::Fields::PUBLISHER_FACET, Index::Fields::RESEARCH_HELP_CONTACT, Index::Fields::RESOURCE_ROLE, Index::Fields::SERIES_FACET, Index::Fields::SETTING_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_ICC_PROFILE_NAME, Index::Fields::TECHMD_ICC_PROFILE_VERSION, Index::Fields::TECHMD_IMAGE_HEIGHT, Index::Fields::TECHMD_IMAGE_WIDTH, Index::Fields::TECHMD_MEDIA_TYPE, Index::Fields::TECHMD_MODIFICATION_TIME, Index::Fields::TECHMD_PRONOM_IDENTIFIER, Index::Fields::TECHMD_VALID, Index::Fields::TECHMD_WELL_FORMED, Index::Fields::TITLE, Index::Fields::TONE_FACET, Index::Fields::TYPE_FACET, 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
129
130
131
132
133
134
135
|
# File 'lib/ddr/models/indexing.rb', line 129
def admin_set_facet
if admin_set.present?
admin_set
elsif associated_collection.present?
associated_collection.admin_set
end
end
|
#admin_set_title ⇒ Object
137
138
139
140
141
142
143
144
145
146
|
# File 'lib/ddr/models/indexing.rb', line 137
def admin_set_title
code = if admin_set.present?
admin_set
elsif associated_collection.present?
associated_collection.admin_set
end
if as = AdminSet.find_by_code(code)
as.title
end
end
|
#all_identifiers ⇒ Object
119
120
121
|
# File 'lib/ddr/models/indexing.rb', line 119
def all_identifiers
identifier + [local_id, permanent_id, pid].compact
end
|
#associated_collection ⇒ Object
123
124
125
126
127
|
# File 'lib/ddr/models/indexing.rb', line 123
def associated_collection
admin_policy
end
|
#collection_facet ⇒ Object
148
149
150
|
# File 'lib/ddr/models/indexing.rb', line 148
def collection_facet
associated_collection.internal_uri if associated_collection.present?
end
|
#collection_title ⇒ Object
152
153
154
155
156
157
158
|
# File 'lib/ddr/models/indexing.rb', line 152
def collection_title
if instance_of?(Collection)
title_display
elsif associated_collection.present?
associated_collection.title_display
end
end
|
#date_sort ⇒ Object
160
161
162
|
# File 'lib/ddr/models/indexing.rb', line 160
def date_sort
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/ddr/models/indexing.rb', line 18
def index_fields
fields = {
ACCESS_ROLE => roles.to_json,
ADMIN_SET => admin_set,
ADMIN_SET_TITLE => admin_set_title,
ASPACE_ID => aspace_id,
ATTACHED_FILES_HAVING_CONTENT => attached_files_having_content.keys,
BOX_NUMBER_FACET => desc_metadata_values('box_number'),
CATEGORY_FACET => desc_metadata_values('category'),
COLLECTION_TITLE => collection_title,
COMPANY_FACET => desc_metadata_values('company'),
CONTRIBUTOR_FACET => contributor,
CREATOR_FACET => creator,
DATE_FACET => date,
DATE_SORT => date_sort,
DEPOSITOR => depositor,
DISPLAY_FORMAT => display_format,
DOI => adminMetadata.doi,
EAD_ID => ead_id,
FOLDER_FACET => desc_metadata_values('folder'),
FORMAT_FACET => format,
IDENTIFIER_ALL => all_identifiers,
INTERNAL_URI => internal_uri,
IS_LOCKED => is_locked,
LICENSE => license,
LICENSE_DESCRIPTION => rightsMetadata.license.description.first,
LICENSE_TITLE => rightsMetadata.license.title.first,
LICENSE_URL => rightsMetadata.license.url.first,
LOCAL_ID => local_id,
MEDIUM_FACET => desc_metadata_values('medium'),
PERMANENT_ID => permanent_id,
PERMANENT_URL => permanent_url,
PLACEMENT_COMPANY_FACET => desc_metadata_values('placement_company'),
POLICY_ROLE => roles.in_policy_scope.agents,
PRODUCT_FACET => desc_metadata_values('product'),
PUBLICATION_FACET => desc_metadata_values('publication'),
PUBLISHER_FACET => publisher,
RESEARCH_HELP_CONTACT => research_help_contact,
RESOURCE_ROLE => roles.in_resource_scope.agents,
SERIES_FACET => desc_metadata_values('series'),
SETTING_FACET => desc_metadata_values('setting'),
SPATIAL_FACET => desc_metadata_values('spatial'),
SUBJECT_FACET => subject,
TITLE => title_display,
TONE_FACET => desc_metadata_values('tone'),
TYPE_FACET => type,
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[CONTENT_CREATE_DATE] = Ddr::Utils.solr_date(content.createDate)
fields[CONTENT_CONTROL_GROUP] = content.controlGroup
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_uri
end
if is_a? Collection
fields[DEFAULT_LICENSE_DESCRIPTION] = defaultRights.license.description.first
fields[DEFAULT_LICENSE_TITLE] = defaultRights.license.title.first
fields[DEFAULT_LICENSE_URL] = defaultRights.license.url.first
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
112
113
114
115
116
117
|
# File 'lib/ddr/models/indexing.rb', line 112
def title_display
return title.first if title.present?
return identifier.first if identifier.present?
return original_filename if respond_to?(:original_filename) && original_filename.present?
"[#{pid}]"
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
164
165
166
|
# File 'lib/ddr/models/indexing.rb', line 164
def year_facet
YearFacet.call(self)
end
|