class Traject::Indexer::NokogiriIndexer
An indexer sub-class for XML, where the source records in the pipeline are Nokogiri::XML::Document objects. It sets a default reader of NokogiriReader, and includes Traject::Macros::Nokogiri (with `extract_xpath`).
See docs on XML use. (TODO)
Public Class Methods
default_settings()
click to toggle source
Calls superclass method
Traject::Indexer::default_settings
# File lib/traject/indexer/nokogiri_indexer.rb, line 15 def self.default_settings @default_settings ||= super.merge("reader_class_name" => "Traject::NokogiriReader") end
Public Instance Methods
source_record_id_proc()
click to toggle source
Overridden from base Indexer
, try an `id` attribute or element on record.
# File lib/traject/indexer/nokogiri_indexer.rb, line 20 def source_record_id_proc @source_record_id_proc ||= lambda do |source_xml_record| if ( source_xml_record && source_xml_record.kind_of?(Nokogiri::XML::Node) ) source_xml_record['id'] || (el = source_xml_record.at_xpath('./id') && el.text) end end end