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

Returns:

  • (Boolean)


263
264
265
# File 'lib/valkyrie/persistence/solr/model_converter.rb', line 263

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

Instance Method Details

#fieldsObject



271
272
273
274
275
276
277
# File 'lib/valkyrie/persistence/solr/model_converter.rb', line 271

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

#resultObject



267
268
269
# File 'lib/valkyrie/persistence/solr/model_converter.rb', line 267

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