Hi!
I'm using TS + PostgreSQL. When using facets without giving a :type
parameter to my facets attributes, I get this exception:
class Topic < ActiveRecord::Base
define_index do
indexes :subject
has posts_count, :facet => true #, :type => :integer
has status
has created_at
has updated_at
set_property :delta => true
end
...
nico...@imac-de-nicolas-blanco ~/my_forum /sphinx> ./script/console
Loading development environment (Rails 2.2.2)
>> Topic.facets
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.columns
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/attribute.rb:230:in `type_from_database'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/attribute.rb:236:in `translated_type_from_database'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/attribute.rb:148:in `type'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/facet.rb:29:in `value'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/facet_collection.rb:17:in `add_from_results'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/collection.rb:118:in `each_with_groupby_and_count'
from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
attribute_methods.rb:211:in `each_with_index'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/collection.rb:117:in `each'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/collection.rb:117:in `each_with_index'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/collection.rb:117:in `each_with_groupby_and_count'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/facet_collection.rb:16:in `add_from_results'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/search.rb:362:in `facets'
from (irb):1:in `inject'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/search.rb:359:in `each'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/search.rb:359:in `inject'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/search.rb:359:in `facets'
from /Users/nicolas/my_forum/vendor/plugins/thinking_sphinx/lib/
thinking_sphinx/active_record/search.rb:50:in `facets'
from (irb):1>>
The problem seems to be that @model in the type_from_database method
is not initialized.
When I add the :type to my facets attributes, it works.
Nicolas.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---