Sha256: e4271c23f1188d94ac49b1aa1d0578dca8b5a7fc24e5271ff59b435b04f3d67e

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

# Solr indexing for our document class. Still a work in progress.
class DocumentIndexer < Kithe::Indexer
  configure do
    # Kithe
    to_field "model_pk_ssi", obj_extract("id") # the actual db pk, a UUID

    # GeoBlacklight
    to_field "gbl_mdVersion_s", literal("Aardvark")

    # to_field 'geomg_id_s', obj_extract('friendlier_id') # the actual db pk, a UUID

    # Define `to_field`(s) via Element
    Element.indexable.each do |elm|
      to_field elm.solr_field, obj_extract(elm.index_value)
    end

    to_field "gbl_mdModified_dt", obj_extract("gbl_mdModified_dt")

    # May want to switch to or add a 'date published' instead, right
    # now we only have date added to DB, which is what we had in sufia.
    to_field "date_created_dtsi" do |rec, _acc|
      rec.created_at.utc.iso8601 if rec&.created_at
    end

    to_field "date_modified_dtsi" do |rec, _acc|
      rec.updated_at.utc.iso8601 if rec&.updated_at
    end

    # - GEOMG
    to_field "b1g_geom_import_id_ssi", obj_extract("import_id")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
geoblacklight_admin-0.1.0 app/indexers/document_indexer.rb
geoblacklight_admin-0.0.1 app/indexers/document_indexer.rb