#111 ✓ resolved
Robert Zotter

Retrieving multiple stored integer fields

Reported by Robert Zotter | April 19th, 2010 @ 09:48 PM | in 1.2

Similar to ticket #110

class Item
...
 integer :categories,
      :references => Category,
      :using      => :category_ids,
      :multiple   => true,
      :stored     => true
...
end
>> search = Sunspot.search(Item) { keywords "foo" }
>> search.hits.first.stored(:categories)
NoMethodError: undefined method `to_i' for [120000, 127000, 127010, 127011]:Array
    from /Users/rob/workspace/ioffer/vendor/plugins/sunspot-1.1.0/lib/sunspot/type.rb:148:in `cast'
    from /Users/rob/workspace/ioffer/vendor/plugins/sunspot-1.1.0/lib/sunspot/field.rb:56:in `cast'
    from /Users/rob/workspace/ioffer/vendor/plugins/sunspot-1.1.0/lib/sunspot/search/hit.rb:129:in `stored_value'
    from /Users/rob/workspace/ioffer/vendor/plugins/sunspot-1.1.0/lib/sunspot/search/hit.rb:127:in `each'
    from /Users/rob/workspace/ioffer/vendor/plugins/sunspot-1.1.0/lib/sunspot/search/hit.rb:127:in `stored_value'
    from /Users/rob/workspace/ioffer/vendor/plugins/sunspot-1.1.0/lib/sunspot/search/hit.rb:85:in `stored'
    from (irb):27
>> search.hits.first.instance_variable_get(:@stored_values)
>> {"categories_ims"=>[120000, 127000, 127010, 127011]}

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Awesome Solr interaction for Ruby

People watching this ticket

Tags

Referenced by

Pages