Class: Blacklight::Marc::Indexer
- Inherits:
-
Traject::Indexer::MarcIndexer
- Object
- Traject::Indexer::MarcIndexer
- Blacklight::Marc::Indexer
- Includes:
- Traject::Macros::Marc21Semantics, Traject::Macros::MarcFormats
- Defined in:
- lib/blacklight/marc/indexer.rb
Direct Known Subclasses
Defined Under Namespace
Constant Summary collapse
- ATOZ =
('a'..'z').to_a.join('')
- ATOU =
('a'..'u').to_a.join('')
Instance Method Summary collapse
- #get_xml(options = {}) ⇒ Object
-
#initialize ⇒ Indexer
constructor
A new instance of Indexer.
- #trim ⇒ Object
Constructor Details
#initialize ⇒ Indexer
Returns a new instance of Indexer.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/blacklight/marc/indexer.rb', line 22 def initialize super settings do provide "reader_class_name", "Traject::MarcReader" if c = Blacklight.connection_config provide "solr.url", c[:url] end provide "solr_writer.commit_on_close", "true" provide "solr_writer.thread_pool", 1 provide "solr_writer.batch_size", 100 provide "writer_class_name", "Traject::SolrJsonWriter" provide 'processing_thread_pool', 1 provide "log.batch_size", 10_000 end end |
Instance Method Details
#get_xml(options = {}) ⇒ Object
45 46 47 48 49 |
# File 'lib/blacklight/marc/indexer.rb', line 45 def get_xml ={} lambda do |record, accumulator| accumulator << MARC::FastXMLWriter.encode(record) end end |
#trim ⇒ Object
39 40 41 42 43 |
# File 'lib/blacklight/marc/indexer.rb', line 39 def trim lambda do |record, accumulator| accumulator.each {|x| x.strip!} end end |