Module: Solrizer

Extended by:
ActiveSupport::Autoload
Defined in:
lib/solrizer/common.rb,
lib/solrizer.rb,
lib/solrizer/suffix.rb,
lib/solrizer/version.rb,
lib/solrizer/extractor.rb,
lib/solrizer/descriptor.rb,
lib/solrizer/field_mapper.rb,
lib/solrizer/default_descriptors.rb

Overview

The goal of this method is to have no dependency on OM, so that NOM or RDF datastreams could use this.

Defined Under Namespace

Modules: Common, DefaultDescriptors, HTML, XML Classes: Descriptor, Extractor, FieldMapper, InvalidIndexDescriptor, SolrizerError, StringDescriptor, Suffix, UnknownIndexMacro

Constant Summary collapse

VERSION =
"3.4.0"

Class Method Summary collapse

Class Method Details

.default_field_mapperObject



24
25
26
# File 'lib/solrizer.rb', line 24

def default_field_mapper
  @@default_field_mapper ||= Solrizer::FieldMapper.new
end

.default_field_mapper=(field_mapper) ⇒ Object



28
29
30
# File 'lib/solrizer.rb', line 28

def default_field_mapper=(field_mapper)
  @@default_field_mapper = field_mapper
end

.insert_field(doc, name, value, *indexer_args) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/solrizer.rb', line 42

def insert_field(doc, name, value, *indexer_args)
  # adding defaults indexer
  indexer_args = [:stored_searchable] if indexer_args.empty?
  default_field_mapper.solr_names_and_values(name, value, indexer_args).each do |k, v|
    doc[k] ||= []
    if v.is_a? Array
      doc[k] += v
    else
      doc[k] = v
    end
  end
  doc
end

.set_field(doc, name, value, *indexer_args) ⇒ Object



61
62
63
64
65
66
# File 'lib/solrizer.rb', line 61

def set_field(doc, name, value, *indexer_args)
  # adding defaults indexer
  indexer_args = [:stored_searchable] if indexer_args.empty?
  doc.merge! default_field_mapper.solr_names_and_values(name, value, indexer_args)
  doc
end

.solr_name(*args) ⇒ Object



33
34
35
# File 'lib/solrizer.rb', line 33

def solr_name(*args)
  default_field_mapper.solr_name(*args)
end

.versionObject



20
21
22
# File 'lib/solrizer.rb', line 20

def version
  Solrizer::VERSION
end