Sorry for the slow response Mike - just looking at the Sphinx docs, it appears we have the syntax wrong - try something like the following instead:
IN(category_id, 1, 2, 3) OR IN(category_id2, 4, 5, 6) -- Pat On 06/09/2011, at 4:51 PM, Mike C. wrote: > Yes still get error message with multiple integers for a single > attribute. > > Riddle::ResponseError: searchd error (status: 1): select: syntax > error, unexpected SEL_TOKEN near 'in (560,716,314)) AS display' > > On Sep 5, 7:21 pm, Pat Allan <[email protected]> wrote: >> Hi Mike >> >> Do you still get the syntax error if you have multiple integers for a single >> attribute? >> >> eg: "*, (category IN (1, 2, 3) AS display) >> >> -- >> Pat >> >> On 05/09/2011, at 8:26 PM, Mike C. wrote: >> >> >> >> >> >> >> >>> Is it possible to use multiple "OR" conditions with collection of ids? >> >>> eg. user_id in(1,2,3) or category_id in(1,23,45) or category_id2 >>> in(23,45,67) >> >>> Here is the model: >> >>> define_index do >>> indexes created_at >>> has :id >>> has user_id >>> has category_id >>> has category_id2 >>> has category_id3 >>> set_property :enable_star => true >>> set_property :min_prefix_len => 1 >>> end >> >>> The first attempt was: >> >>> Example.search(:with=>{:category_id=>[1,2,3],:category_id2=>[23,45,56],:category_id3=>[67,77,89,23]}) >> >>> BUT it searches with "AND" condition >> >>> The second attempt was: >> >>> with_display = "*, (category_id in(1,2,3) OR category_id2 in(5, >>> 1,23,56) OR category_id3 in(23,45,67)) AS display" >>> Example.search (:sphinx_select => with_display,:with=> {'display' => >>> 1}) >> >>> This works when passing a single ID for each category but with a >>> collection it generates an error in console: >> >>> Riddle::ResponseError: searchd error (status: 1): select: syntax >>> error, unexpected ',' >> >>> -- >>> 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 >>> athttp://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. > -- 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.
