Class: Sunspot::FieldFactory::Join

Inherits:
Abstract
  • Object
show all
Defined in:
lib/sunspot/field_factory.rb

Instance Attribute Summary

Attributes inherited from Abstract

#name

Instance Method Summary collapse

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, options = {}, &block)
  super(name, options, &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, options)
end

Instance Method Details

#buildObject

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

#signatureObject

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