Without seeing everything you have, it's hard to visualize the
problem.
I'd perhaps play around with the ":without" clause.
Perhaps, :without => {user_id => (1..(id-1))..((id+1)..(2.sqrt(32))}.
I haven't actually tested this yet, so you may also need to click your
heels before pressing enter.
The question I'd ask is: How do you search for tags and how are they
stored?
Either you need to play with the :with / :without magic and add
various has ... attributes, or you need to do some post processing of
your search results. In which case, you might want to set the :limit
=> 9999 or whatever, so you can examine more than just the 20 results.
scott
On May 20, 8:01 am, Julien Palmas <[email protected]> wrote:
> Altrus,
>
> I search for Articles, not for Tags.
>
> i could do
>
> Article
>
> define_index do
> indexes tags.name, :as => :tag
> has tags.user_id, :as => :tags_user_ids
> end
>
> and then
>
> Article.search "@tag tag_2", :with => {:tags_user_ids =>
> current_user.id}, :match_mode => :extended
>
> but since both "user_1" and "user_2" tagged this article, I would
> still find ["article"], and I'd like to find []
>
> On May 20, 4:43 pm, aitrus <[email protected]> wrote:
>
> > 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
-~----------~----~----~----~------~----~------~--~---