Try this...

      has taggings.tag_id, :as => :tag_ids

On Jan 17, 2:20 pm, Brian Roisentul <[email protected]> wrote:
> Hi,
>
> I installed Sphinx and Thinking Sphinx for ruby on rails 2.3.2.
>
> When I search without conditions search works ok. Now, what I'd like
> to do is filter by tags, so, as I'm using the acts_as_taggable_on
> plugin, my Announcement model looks like this:
>
> class Announcement < ActiveRecord::Base
>
>   acts_as_taggable_on :tags,:category
>
>   define_index do
>     indexes title, :as => :title, :sortable => true
>     indexes description, :as => :description, :sortable => true
>     indexes tags.name, :as => :tags
>     indexes category.name, :as => :category
>
>     has category(:id), :as => :category_ids
>     has tags(:id), :as => :tag_ids
>   end
>
> For some reason, when I run the following command, it will bring just
> one announcement, that has nothing to do with what I expect. I've got
> many announcements, so I expected a lot of results instead.
>
> Announcement.search params[:announcement][:search].to_s, :with =>
> {:tag_ids => 1}, :page => params[:page], :per_page => 10
>
> I guess something is wrong, and it's not searching correctly.
>
> Can anyone give my a clue of what's going on?
>
> Thanks, Brian
-- 
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