You should be able to just do a "has :user_id, :as
=> :has_user_id" (name it whatever you want).
Then do:
Tag.search "Blah", :with => {:has_user_id => @user_id}
On May 20, 7:22 am, Julien Palmas <[email protected]> wrote:
> Hello,
>
> Here is my problem,
>
> I have 4 models :
>
> User
>
> Article
> has_many :join_models, :as => :taggable,
> has_many :tags, :through => : join_models
>
> define_index do
> indexes tags.name, :as => :tag
> end
>
> Tag
> belongs_to :user
> has_many :join_models
>
> JoinModel
> belongs_to :tag
> belongs_to :taggable, :polymorphic => true
>
> Each user can create a tag and the attach it to an article.
>
> Let say
> "user_1" creates "tag_1" and attaches it to "article"
> and
> "user_2" creates "tag_2" and attaches it to "article"
>
> I am logged in in my app as "user_1" and search for :
> Article.search "@tag tag_2", :match_mode => :extended
>
> This search returns ["article"], since Sphinx indexed "tag_2" for
> "article"
> I would like this search to return [], since I am not the user whom
> tagged this article with this tag.
>
> How can I do that ? Facets maybe ?
>
> Thx
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---