Class: Sunspot::AttributeField
- Inherits:
-
Field
- Object
- Field
- Sunspot::AttributeField
- Defined in:
- sunspot/lib/sunspot/field.rb
Overview
AttributeField instances encapsulate non-tokenized attribute data. AttributeFields can have any type except TextType, and can also have a reference (for instantiated facets), optionally allow multiple values (false by default), and can store their values (false by default). All scoping, sorting, and faceting is done with attribute fields.
Instance Attribute Summary
Attributes inherited from Field
boost, indexed_name, name, reference, type
Instance Method Summary (collapse)
-
- (AttributeField) initialize(name, type, options = {})
constructor
:nodoc:.
Methods inherited from Field
#cast, #eql?, #hash, #more_like_this?, #multiple?, #to_indexed
Constructor Details
- (AttributeField) initialize(name, type, options = {})
:nodoc:
147 148 149 150 151 152 153 154 155 156 157 |
# File 'sunspot/lib/sunspot/field.rb', line 147 def initialize(name, type, = {}) @multiple = !!.delete(:multiple) super(name, type, ) @reference = if (reference = .delete(:references)).respond_to?(:name) reference.name elsif reference.respond_to?(:to_sym) reference.to_sym end raise ArgumentError, "Unknown field option #{.keys.first.inspect} provided for field #{name.inspect}" unless .empty? end |