You'll want to use :conditions instead of :with - as you're limiting your
search to a specific field, not an attribute.
Also, your comment_login attribute will not work, as Sphinx has no concept of
collections of strings for attributes - the only multi-value type is integers.
--
Pat
On 09/01/2012, at 11:50 PM, jebw wrote:
> I've set up a search on a blog_posts model as below, it has_many
> blog_comments, and both it and comments are joined to users - login is
> the username.
>
> define_index do
> indexes title
> indexes body
> indexes blog_comments.comment, :as => :comment_content
>
> has user.login
> has blog_comments.user.login, :as => :comment_login
> end
>
> For some reason the following search
>
> BlogPost.search :with => { :comment_login => 'fred' }
>
> is returning Blog Posts which have no comments, and which were not
> authored by fred - why is this, I'm guessing theres something wrong
> with how I'm querying. How do I go about debugging the queries which
> are being produced - the searchd.query.log just contains the following
> row.
>
> [Mon Jan 9 12:38:12.696 2012] 0.000 sec [all/3/rel 4 (0,20)]
> [blog_post_core]
>
> thanks, jebw
>
> --
> 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.
>
--
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.