Class: Valkyrie::Persistence::Solr::ModelConverter::StringPropertyValue

Inherits:
ValueMapper
  • Object
show all
Defined in:
lib/valkyrie/persistence/solr/model_converter.rb

Overview

Handles casting strings.

Instance Attribute Summary

Attributes inherited from ValueMapper

#calling_mapper, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ValueMapper

for, #initialize, register

Constructor Details

This class inherits a constructor from Valkyrie::ValueMapper

Class Method Details

.handles?(value) ⇒ Boolean

Determines whether or not a Property value is a String

Parameters:

  • value (Object)

Returns:

  • (Boolean)


419
420
421
# File 'lib/valkyrie/persistence/solr/model_converter.rb', line 419

def self.handles?(value)
  value.is_a?(Property) && value.value.is_a?(String)
end

Instance Method Details

#fieldsArray<Symbol>

Generates the Solr fields used during the indexing String are normally indexed using the following:

- stored text
- stored english text
- stored single string
- multivalued string
- stored multivalued text
- stored multivalued english text

If the string is greater than 1000 characters in length, it is only indexed as a stored multivalued text



441
442
443
444
445
446
447
# File 'lib/valkyrie/persistence/solr/model_converter.rb', line 441

def fields
  if value.value.length > 1000
    [:tsim]
  else
    [:tsim, :ssim, :tesim, :tsi, :ssi, :tesi]
  end
end

#resultSolrRow

Constructs a SolrRow object with the String values and Solr field settings

Returns:



425
426
427
# File 'lib/valkyrie/persistence/solr/model_converter.rb', line 425

def result
  SolrRow.new(key: value.key, fields: fields, values: value.value)
end