Module: Cul::Hydra::Solrizer::TerminologyBasedSolrizer::ClassMethods

Defined in:
lib/cul_hydra/solrizer/terminology_based_solrizer.rb

Overview

Module Methods

Instance Method Summary collapse

Instance Method Details

#solrize_node(node_value, doc, term_pointer, term, solr_doc = Hash.new, field_mapper = nil, opts = {}) ⇒ Object

Populate a solr document with solr fields corresponding to the given xml node Field names are generated using settings from the term in the doc‘s terminology corresponding to term_pointer

Parameters:

  • node (Nokogiri::XML::Node)

    to solrize

  • doc (OM::XML::Document)

    document the node came from

  • term_pointer (Array)

    Array pointing to the term that should be used for solrization settings

  • (optional) (Hash)

    solr_doc (values hash) to populate



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cul_hydra/solrizer/terminology_based_solrizer.rb', line 18

def solrize_node(node_value, doc, term_pointer, term, solr_doc = Hash.new, field_mapper = nil, opts = {})
  return solr_doc unless term.index_as && !term.index_as.empty?
  generic_field_name_base = OM::XML::Terminology.term_generic_name(*term_pointer)
  create_and_insert_terms(generic_field_name_base, node_value, term.index_as, solr_doc)
  if term_pointer.length > 1
    #hierarchical_field_name_base = OM::XML::Terminology.term_hierarchical_name(*term_pointer)
    #create_and_insert_terms(hierarchical_field_name_base, node_value, term.index_as, solr_doc)
  end
  if term.variant_of and term.variant_of[:field_base]
    #create_and_insert_terms(term.variant_of[:field_base], node_value, term.index_as, solr_doc)
    create_and_insert_terms(term.variant_of[:field_base], node_value, term.index_as, solr_doc)
  end
  solr_doc
end