Class: Sunspot::FieldFactory::Join
- Defined in:
- lib/sunspot/field_factory.rb
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
-
#build ⇒ Object
Return the field instance built by this factory.
-
#initialize(name, type, options = {}, &block) ⇒ Join
constructor
A new instance of Join.
-
#populate_document(document, model) ⇒ Object
Extract the encapsulated field’s data from the given model and add it into the Solr document for indexing.
-
#signature ⇒ Object
A unique signature identifying this field by name and type.
Constructor Details
#initialize(name, type, options = {}, &block) ⇒ Join
Returns a new instance of Join.
80 81 82 83 84 85 86 87 |
# File 'lib/sunspot/field_factory.rb', line 80 def initialize(name, type, = {}, &block) super(name, , &block) unless name.to_s =~ /^\w+$/ raise ArgumentError, "Invalid field name #{name}: only letters, numbers, and underscores are allowed." end @field = JoinField.new(name, type, ) end |
Instance Method Details
#build ⇒ Object
Return the field instance built by this factory
92 93 94 |
# File 'lib/sunspot/field_factory.rb', line 92 def build @field end |
#populate_document(document, model) ⇒ Object
Extract the encapsulated field’s data from the given model and add it into the Solr document for indexing. (noop here for joins)
100 101 102 |
# File 'lib/sunspot/field_factory.rb', line 100 def populate_document(document, model) #:nodoc: end |
#signature ⇒ Object
A unique signature identifying this field by name and type.
107 108 109 |
# File 'lib/sunspot/field_factory.rb', line 107 def signature ['join', @field.name, @field.type] end |