Class: Sunspot::FulltextField

Inherits:
Field
  • Object
show all
Defined in:
lib/sunspot/field.rb

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

Attributes inherited from Field

#attributes, #name, #reference, #type

Instance Method Summary collapse

Methods inherited from Field

#cast, #indexed_name, #multiple?, #to_indexed

Constructor Details

#initialize(name, options = {}) ⇒ FulltextField

:nodoc:

Raises:

  • (ArgumentError)


90
91
92
93
94
95
96
97
# File 'lib/sunspot/field.rb', line 90

def initialize(name, options = {})
  super(name, Type::TextType)
  if options.has_key?(:boost)
    @attributes[:boost] = options.delete(:boost)
  end
  @multiple = true
  raise ArgumentError, "Unknown field option #{options.keys.first.inspect} provided for field #{name.inspect}" unless options.empty?
end