From 84f9524b92786f9c380a8694b77554f711953c8f Mon Sep 17 00:00:00 2001 From: Longshou Situ Date: Tue, 29 Aug 2023 11:01:03 -0700 Subject: [PATCH] Revert "get collection indexing working" This reverts commit 688da28584e0df58de7dec8e6b3546c742c603e9. --- .koppie/app/forms/collection_resource_form.rb | 1 - .../indexers/collection_resource_indexer.rb | 1 - .koppie/app/models/collection_resource.rb | 1 - .../config/metadata/collection_resource.yaml | 129 +++++++++++++++++- app/indexers/hyrax/pcdm_collection_indexer.rb | 6 - 5 files changed, 128 insertions(+), 10 deletions(-) diff --git a/.koppie/app/forms/collection_resource_form.rb b/.koppie/app/forms/collection_resource_form.rb index f9b2bf5938..0d2c22443d 100644 --- a/.koppie/app/forms/collection_resource_form.rb +++ b/.koppie/app/forms/collection_resource_form.rb @@ -3,6 +3,5 @@ # Generated via # `rails generate hyrax:collection_resource CollectionResource` class CollectionResourceForm < Hyrax::Forms::PcdmCollectionForm - include Hyrax::FormFields(:basic_metadata) include Hyrax::FormFields(:collection_resource) end diff --git a/.koppie/app/indexers/collection_resource_indexer.rb b/.koppie/app/indexers/collection_resource_indexer.rb index c8dd88b84e..f7d55ca8ec 100644 --- a/.koppie/app/indexers/collection_resource_indexer.rb +++ b/.koppie/app/indexers/collection_resource_indexer.rb @@ -3,6 +3,5 @@ # Generated via # `rails generate hyrax:collection_resource CollectionResource` class CollectionResourceIndexer < Hyrax::PcdmCollectionIndexer - include Hyrax::Indexer(:basic_metadata) include Hyrax::Indexer(:collection_resource) end diff --git a/.koppie/app/models/collection_resource.rb b/.koppie/app/models/collection_resource.rb index 8ba57bc859..758b6d2784 100644 --- a/.koppie/app/models/collection_resource.rb +++ b/.koppie/app/models/collection_resource.rb @@ -27,6 +27,5 @@ 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 diff --git a/.koppie/config/metadata/collection_resource.yaml b/.koppie/config/metadata/collection_resource.yaml index 64fb3b3601..1f1e82fdfc 100644 --- a/.koppie/config/metadata/collection_resource.yaml +++ b/.koppie/config/metadata/collection_resource.yaml @@ -19,4 +19,131 @@ # Generated via # `rails generate hyrax:collection_resource CollectionResource` -attributes: {} +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 diff --git a/app/indexers/hyrax/pcdm_collection_indexer.rb b/app/indexers/hyrax/pcdm_collection_indexer.rb index 08954e76b3..14435278d3 100644 --- a/app/indexers/hyrax/pcdm_collection_indexer.rb +++ b/app/indexers/hyrax/pcdm_collection_indexer.rb @@ -19,12 +19,6 @@ 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