Method: Sunspot::CompositeSetup#text_field

Defined in:
lib/sunspot/composite_setup.rb

#text_field(field_name) ⇒ Object

Get a text field object by its public name. A field will be returned if it is configured for any of the enclosed types.

Returns

Sunspot::FulltextField

Text field with the given public name

Raises

UnrecognizedFieldError

If no field with that name is configured for any of the enclosed types.



51
52
53
54
55
56
# File 'lib/sunspot/composite_setup.rb', line 51

def text_field(field_name)
  text_fields_hash[field_name.to_sym] || raise(
    UnrecognizedFieldError,
    "No text field configured for #{@types * ', '} with name '#{field_name}'"
  )
end