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_HAVING_CONTENT, Index::Fields::BOX_NUMBER_FACET, Index::Fields::COLLECTION_FACET, Index::Fields::COLLECTION_URI, 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::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_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::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::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_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::WORKFLOW_STATE, Index::Fields::YEAR_FACET
Class Method Summary
collapse
Instance Method Summary
collapse
descmd, get, techmd
Class Method Details
.const_missing(name) ⇒ Object
9
10
11
|
# File 'lib/ddr/models/indexing.rb', line 9
def self.const_missing(name)
Ddr::Index::Fields.const_missing(name)
end
|
Instance Method Details
#admin_set_facet ⇒ Object
115
116
117
118
119
120
121
|
# File 'lib/ddr/models/indexing.rb', line 115
def admin_set_facet
if admin_set.present?
admin_set
elsif associated_collection.present?
associated_collection.admin_set
end
end
|
#all_identifiers ⇒ Object
107
108
109
|
# File 'lib/ddr/models/indexing.rb', line 107
def all_identifiers
identifier + [local_id, permanent_id, pid].compact
end
|
#associated_collection ⇒ Object
111
112
113
|
# File 'lib/ddr/models/indexing.rb', line 111
def associated_collection
admin_policy
end
|
#collection_facet ⇒ Object
123
124
125
|
# File 'lib/ddr/models/indexing.rb', line 123
def collection_facet
associated_collection.internal_uri if associated_collection.present?
end
|
#date_sort ⇒ Object
127
128
129
|
# File 'lib/ddr/models/indexing.rb', line 127
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
|
# 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_HAVING_CONTENT => attached_files_having_content.keys,
BOX_NUMBER_FACET => desc_metadata_values('box_number'),
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,
FORMAT_FACET => format,
IDENTIFIER_ALL => all_identifiers,
INTERNAL_URI => internal_uri,
LICENSE => license,
LICENSE_DESCRIPTION => rightsMetadata.license.description.first,
LICENSE_TITLE => rightsMetadata.license.title.first,
LICENSE_URL => rightsMetadata.license.url.first,
LOCAL_ID => local_id,
PERMANENT_ID => permanent_id,
PERMANENT_URL => permanent_url,
POLICY_ROLE => roles.in_policy_scope.agents,
PUBLISHER_FACET => 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 => subject,
TITLE => title_display,
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[] = .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
100
101
102
103
104
105
|
# File 'lib/ddr/models/indexing.rb', line 100
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
131
132
133
|
# File 'lib/ddr/models/indexing.rb', line 131
def year_facet
YearFacet.call(self)
end
|