Hi,
I have a use case where I need to use OR logic with attribute filters. Here
is the scenario, User has many roles and has an attribute called global.
Below is the index block
define_index do
has roles(:id), :as => :role_ids
has global
end
And I need to get users with have roles with id 5 or the users with global
true. Here is the query I am trying to use
User.search(:sphinx_select => "*, IF(global OR role_ids = 5, 1, 0) AS
program_global", :with => {'program_global' => true})
This results in a syntax error - *unexpected TOK_ATTR_MVA near 'role_ids =
5, 1, 0)'* . The problem here seems to be that role_ids is a MVA.
Any help?
Thank you,
Sabarish
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/thinking-sphinx/-/id94c3zziyYJ.
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.