Module: Ddr::Models::Indexing
- Includes:
- IndexFields
- Included in:
- Base
- Defined in:
- lib/ddr/models/indexing.rb
Constant Summary
Constants included
from IndexFields
IndexFields::ACTIVE_FEDORA_MODEL, IndexFields::COLLECTION_URI, IndexFields::CONTENT_CONTROL_GROUP, IndexFields::CONTENT_SIZE, IndexFields::CONTENT_SIZE_HUMAN, IndexFields::DEFAULT_LICENSE_DESCRIPTION, IndexFields::DEFAULT_LICENSE_TITLE, IndexFields::DEFAULT_LICENSE_URL, IndexFields::FILE_GROUP, IndexFields::FILE_USE, IndexFields::HAS_MODEL, IndexFields::IDENTIFIER, IndexFields::INTERNAL_URI, IndexFields::IS_ATTACHED_TO, IndexFields::IS_EXTERNAL_TARGET_FOR, IndexFields::IS_GOVERNED_BY, IndexFields::IS_MEMBER_OF, IndexFields::IS_MEMBER_OF_COLLECTION, IndexFields::IS_PART_OF, IndexFields::LAST_FIXITY_CHECK_ON, IndexFields::LAST_FIXITY_CHECK_OUTCOME, IndexFields::LAST_VIRUS_CHECK_ON, IndexFields::LAST_VIRUS_CHECK_OUTCOME, IndexFields::LICENSE_DESCRIPTION, IndexFields::LICENSE_TITLE, IndexFields::LICENSE_URL, IndexFields::LOCAL_ID, IndexFields::MEDIA_MAJOR_TYPE, IndexFields::MEDIA_SUB_TYPE, IndexFields::MEDIA_TYPE, IndexFields::OBJECT_CREATE_DATE, IndexFields::OBJECT_MODIFIED_DATE, IndexFields::OBJECT_PROFILE, IndexFields::OBJECT_STATE, IndexFields::ORDER, IndexFields::PERMANENT_ID, IndexFields::PERMANENT_URL, IndexFields::TITLE, IndexFields::WORKFLOW_STATE
Instance Method Summary
collapse
solr_name
Instance Method Details
#identifier_sort ⇒ Object
70
71
72
|
# File 'lib/ddr/models/indexing.rb', line 70
def identifier_sort
identifier.first
end
|
#index_fields ⇒ Object
12
13
14
15
16
17
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
|
# File 'lib/ddr/models/indexing.rb', line 12
def index_fields
fields = {
TITLE => title_display,
INTERNAL_URI => internal_uri,
IDENTIFIER => identifier_sort,
WORKFLOW_STATE => workflow_state
}
if permanent_id.present?
fields[PERMANENT_ID] = permanent_id
end
if permanent_url.present?
fields[PERMANENT_URL] = permanent_url
end
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 respond_to? :license
fields[LICENSE_DESCRIPTION] = license_description
fields[LICENSE_TITLE] = license_title
fields[LICENSE_URL] = license_url
end
if has_content?
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
end
if is_a? Component
fields[COLLECTION_URI] = collection_uri
end
if is_a? Collection
fields[DEFAULT_LICENSE_DESCRIPTION] = default_license_description
fields[DEFAULT_LICENSE_TITLE] = default_license_title
fields[DEFAULT_LICENSE_URL] = default_license_url
end
if respond_to? :roles
fields.merge!(roles.index_fields)
end
if local_id.present?
fields[LOCAL_ID] = local_id
end
fields
end
|
#title_display ⇒ Object
63
64
65
66
67
68
|
# File 'lib/ddr/models/indexing.rb', line 63
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
7
8
9
10
|
# File 'lib/ddr/models/indexing.rb', line 7
def to_solr(solr_doc=Hash.new, opts={})
solr_doc = super(solr_doc, opts)
solr_doc.merge index_fields
end
|