I have a Thinking Sphinx (V3) index that looks something like this (I'm using Rails 3.2):
ThinkingSphinx::Index.define(:search_table, :with => :active_record) do
# fields
indexes public
# attributes
has members.id, as: :members
end
The key elements of the search_table index are a boolean field public, and a has_many attribute of integers, named members.
Assume a member_id value exists in the controller. I'd like to fetch all results in a Thinking Sphinx query that satisfy the following predicate:
public = true OR (public = false AND (members CONTAINS member_id))
I have experimented with specifying custom SQL in the Thinking Sphinx query, but I'm stuck. Can anyone point me in the right direction?