I am in the process of migrating the search function of our RoR web-
application from using Ferret to Sphinx, but I am having problems with
search conditions. Specifically, we have a condition expressed in SQL
thus:

    private = 0 OR user_id IN (1,3,5)

private is a boolean indicating whether a post is private or not, and
user_id is the id of the user owning the post. (1,3,5) is taken from
the current user's friend ids (i.e. current_user.friend_ids). So, the
above condition states 'where a post is not private, or it belongs to
one of my friends'. I hope that makes sense. ;-)

When performing a search with Thinking Sphinx, I assumed that I could
do the following:

    Post.search(params[:q], :conditions => [ %Q(private = :false OR
user_id IN (:friend_ids)), { :false => false, :friend_ids =>
current_user.friend_ids }])

But TS only supports passing a hash of conditions, which get ANDed.
How can I express this OR condition when searching?

Cheers
Matthew

--~--~---------~--~----~------------~-------~--~----~
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