Explicit aliases are required for associations when doing facets

Try..

has section.title, :as => :section_title, :facet => true

On Jun 2, 2:45 am, syed <[email protected]> wrote:
> Hi,
>
> The define_index method inside my Item model looks like this:
>
> define_index do
>         indexes body
>         indexes title
>         has created_at, published, promoted
>         has section.title, :facet => true
> end
>
> My searches are working fine, but when I try to query facets
>
> Item.facets
> Item.facets 'lorem'
> ThinkingSphinx.facets
>
> I get this error:
>
> NoMethodError: undefined method `value' for nil:NilClass
>         from /var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/
> whiny_nil.rb:52:in `method_missing'
>         from /var/lib/gems/1.8/gems/thinking-sphinx-1.3.16/lib/
> thinking_sphinx/facet_search.rb:114:in `add_from_results'
>         from /var/lib/gems/1.8/gems/thinking-sphinx-1.3.16/lib/
> thinking_sphinx/search.rb:219:in `each_with_groupby_and_count'
>         from /var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/
> attribute_methods.rb:211:in `each_with_index'
>         from /var/lib/gems/1.8/gems/thinking-sphinx-1.3.16/lib/
> thinking_sphinx/search.rb:218:in `each'
>         from /var/lib/gems/1.8/gems/thinking-sphinx-1.3.16/lib/
> thinking_sphinx/search.rb:218:in `each_with_index'
>         from /var/lib/gems/1.8/gems/thinking-sphinx-1.3.16/lib/
> thinking_sphinx/search.rb:218:in `each_with_groupby_and_count'
>         from /var/lib/gems/1.8/gems/thinking-sphinx-1.3.16/lib/
> thinking_sphinx/facet_search.rb:113:in `add_from_results'
>         from /var/lib/gems/1.8/gems/thinking-sphinx-1.3.16/lib/
> thinking_sphinx/facet_search.rb:49:in `populate'
>         from /var/lib/gems/1.8/gems/thinking-sphinx-1.3.16/lib/
> thinking_sphinx/facet_search.rb:47:in `each'
>         from /var/lib/gems/1.8/gems/thinking-sphinx-1.3.16/lib/
> thinking_sphinx/facet_search.rb:47:in `populate'
>         from /var/lib/gems/1.8/gems/thinking-sphinx-1.3.16/lib/
> thinking_sphinx/facet_search.rb:13:in `initialize'
>         from /var/lib/gems/1.8/gems/thinking-sphinx-1.3.16/lib/
> thinking_sphinx/search_methods.rb:422:in `new'
>         from /var/lib/gems/1.8/gems/thinking-sphinx-1.3.16/lib/
> thinking_sphinx/search_methods.rb:422:in `facets'
>
> I've gone by the documentation, indexed, configured, rebuilt but to no
> avail.
>
> Am I doing something wrong here?

-- 
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.

Reply via email to