Skip to content

Commit

Permalink
get collection indexing working
Browse files Browse the repository at this point in the history
  • Loading branch information
summer-cook committed Jun 29, 2023
1 parent eaf5a1f commit 688da28
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 128 deletions.
1 change: 1 addition & 0 deletions .koppie/app/forms/collection_resource_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
# Generated via
# `rails generate hyrax:collection_resource CollectionResource`
class CollectionResourceForm < Hyrax::Forms::PcdmCollectionForm
include Hyrax::FormFields(:basic_metadata)
include Hyrax::FormFields(:collection_resource)
end
1 change: 1 addition & 0 deletions .koppie/app/indexers/collection_resource_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
# Generated via
# `rails generate hyrax:collection_resource CollectionResource`
class CollectionResourceIndexer < Hyrax::PcdmCollectionIndexer
include Hyrax::Indexer(:basic_metadata)
include Hyrax::Indexer(:collection_resource)
end
1 change: 1 addition & 0 deletions .koppie/app/models/collection_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ class CollectionResource < Hyrax::PcdmCollection
# * add Valkyrie attributes to this class
# * update form and indexer to process the attributes
#
include Hyrax::Schema(:basic_metadata)
include Hyrax::Schema(:collection_resource)
end
129 changes: 1 addition & 128 deletions .koppie/config/metadata/collection_resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,131 +19,4 @@
# Generated via
# `rails generate hyrax:collection_resource CollectionResource`

attributes:
description:
type: string
multiple: true
form:
primary: true
index_keys:
- "description_tesim"
creator:
type: string
multiple: true
form:
required: false
primary: false
index_keys:
- "creator_tesim"
rights_statement:
type: string
multiple: true
form:
primary: false
abstract:
type: string
multiple: true
form:
primary: false
access_right:
type: string
multiple: true
form:
primary: false
alternative_title:
type: string
multiple: true
form:
primary: false
based_near:
type: string
multiple: true
form:
primary: false
index_keys:
- "based_near_sim"
- "based_near_tesim"
bibliographic_citation:
type: string
multiple: true
contributor:
type: string
multiple: true
form:
primary: false
date_created:
type: date_time
multiple: true
form:
primary: false
index_keys:
- "date_created_tesim"
identifier:
type: string
multiple: true
form:
primary: false
import_url:
type: string
keyword:
type: string
multiple: true
index_keys:
- "keyword_sim"
- "keyword_tesim"
form:
primary: false
publisher:
type: string
multiple: true
form:
primary: false
label:
type: string
form:
primary: false
language:
type: string
multiple: true
form:
primary: false
license:
type: string
multiple: true
form:
primary: false
relative_path:
type: string
related_url:
type: string
multiple: true
form:
primary: false
index_keys:
- "related_url_tesim"
resource_type:
type: string
multiple: true
form:
primary: false
index_keys:
- "resource_type_sim"
- "resource_type_tesim"
rights_notes:
type: string
multiple: true
form:
primary: false
source:
type: string
multiple: true
form:
primary: false
subject:
type: string
multiple: true
index_keys:
- "subject_sim"
- "subject_tesim"
form:
primary: false
attributes: {}
6 changes: 6 additions & 0 deletions app/indexers/hyrax/pcdm_collection_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ def to_solr
index_document[:member_of_collection_ids_ssim] = resource.member_of_collection_ids.map(&:to_s)
index_document[:depositor_ssim] = [resource.depositor]
index_document[:depositor_tesim] = [resource.depositor]
# add all attributes that should be indexed for collections here
tesim_and_ssim_attributes = ['abstract', 'access_right', 'alternative_title', 'based_near', 'bibliographic_citation', 'contributor', 'identifier', 'import_url', 'publisher', 'label', 'language', 'license', 'publisher', 'rights_notes', 'rights_statement', 'source', 'subject']
tesim_and_ssim_attributes.each do |attribute|
index_document["#{attribute}_ssim"] = resource["#{attribute}"]
index_document["#{attribute}_tesim"] = resource["#{attribute}"]
end
end
end
end
Expand Down

0 comments on commit 688da28

Please sign in to comment.