Class: Sunspot::FulltextField
Overview
FulltextField instances represent fields that are indexed as fulltext. These fields are tokenized in the index, and can have boost applied to them. They also always allow multiple values (since the only downside of allowing multiple values is that it prevents the field from being sortable, and sorting on tokenized fields is nonsensical anyway, there is no reason to do otherwise). FulltextField instances always have the type TextType.
Instance Attribute Summary collapse
-
#boost ⇒ Object
readonly
:nodoc:.
-
#default_boost ⇒ Object
readonly
:nodoc:.
Attributes inherited from Field
#attributes, #name, #reference, #type
Instance Method Summary collapse
- #indexed_name ⇒ Object
-
#initialize(name, options = {}) ⇒ FulltextField
constructor
A new instance of FulltextField.
Methods inherited from Field
#cast, #eql?, #hash, #multiple?, #to_indexed
Constructor Details
#initialize(name, options = {}) ⇒ FulltextField
Returns a new instance of FulltextField.
102 103 104 105 106 107 108 109 110 |
# File 'lib/sunspot/field.rb', line 102 def initialize(name, = {}) super(name, Type::TextType, ) @multiple = true if boost = .delete(:boost) @attributes[:boost] = boost end @default_boost = .delete(:default_boost) raise ArgumentError, "Unknown field option #{.keys.first.inspect} provided for field #{name.inspect}" unless .empty? end |
Instance Attribute Details
#boost ⇒ Object (readonly)
:nodoc:
100 101 102 |
# File 'lib/sunspot/field.rb', line 100 def boost @boost end |
#default_boost ⇒ Object (readonly)
:nodoc:
100 101 102 |
# File 'lib/sunspot/field.rb', line 100 def default_boost @default_boost end |
Instance Method Details
#indexed_name ⇒ Object
112 113 114 |
# File 'lib/sunspot/field.rb', line 112 def indexed_name "#{super}#{'s' if @stored}" end |