Thanks for you quick response!  It doesn't work. But, I discovered
that neither of my filters work actually! I mean, in my announcements
table I've got a province_id integer field. When I set up the index as
follows it won't work either:

class Announcement < ActiveRecord::Base

  belongs_to :announcement_type
  belongs_to :user
  belongs_to :province
  has_many :announcement_favorites
  has_many :announcement_comments
  has_many :announcement_subscriptions
  has_many :announcement_views
  acts_as_taggable_on :tags

  validates_presence_of :title, :description, :expirationDate

  define_index do
    indexes title, :as => :title
    indexes description, :as => :description

    has province_id, :as => :province_id #or without the alias
  end

I've got TS 1.3.14 and Sphinx 0.9.9, Am I missing something? Please
help!

Thanks,
Brian

On Jan 17, 10:16 pm, Jon Crawford <[email protected]> wrote:
> 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