Sha256: d7e7e45be9e27c00ee6f39b8f3cda943d4a9c4b7a20458ca9358e0f990dec771

Contents?: true

Size: 964 Bytes

Versions: 15

Compression:

Stored size: 964 Bytes

Contents

module Traject
  class Indexer
    # An indexer sub-class that includes "extract_marc" and other macros from
    # Traject::Macros::Marc21, and also adds some marc-specific default settings.
    class MarcIndexer < ::Traject::Indexer
      include Traject::Macros::Marc21

      def self.default_settings
        @default_settings ||= begin
          marc_settings = {
            "reader_class_name"       => "Traject::MarcReader",
            "marc_source.type"        => "binary",
          }
          super.merge(marc_settings)
        end
      end

      # Overridden from base Indexer, to get MARC 001 for log messages.
      def source_record_id_proc
        @source_record_id_proc ||= lambda do |source_marc_record|
          if ( source_marc_record &&
               source_marc_record.kind_of?(MARC::Record) &&
               source_marc_record['001'] )
            source_marc_record['001'].value
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
traject-3.8.3 lib/traject/indexer/marc_indexer.rb
traject-3.8.2 lib/traject/indexer/marc_indexer.rb
traject-3.8.1 lib/traject/indexer/marc_indexer.rb
traject-3.8.0 lib/traject/indexer/marc_indexer.rb
traject-3.7.0 lib/traject/indexer/marc_indexer.rb
traject-3.6.0 lib/traject/indexer/marc_indexer.rb
traject-3.5.0 lib/traject/indexer/marc_indexer.rb
traject-3.4.0 lib/traject/indexer/marc_indexer.rb
traject-3.3.0 lib/traject/indexer/marc_indexer.rb
traject-3.2.0 lib/traject/indexer/marc_indexer.rb
traject-3.1.0 lib/traject/indexer/marc_indexer.rb
traject-3.1.0.rc1 lib/traject/indexer/marc_indexer.rb
traject-3.0.0 lib/traject/indexer/marc_indexer.rb
traject-3.0.0.alpha.2 lib/traject/indexer/marc_indexer.rb
traject-3.0.0.alpha.1 lib/traject/indexer/marc_indexer.rb