문제

I am trying to perform the following search as per the docs

with_delivery = "*, IF(delivery = 1 OR region_id IN (001,002,003), 1, 0) AS delivery"
Listing.search 'ipod', 
                select: with_delivery, 
                with: { 'delivery' => 1 }

However I get the following error:

 ThinkingSphinx::SyntaxError: sphinxql: syntax error, unexpected IN, expecting ',' or ')' near 'IN (001...

It seems like sphinx cannot handle the IN syntax here, but this does not make sense since it uses this in the configs.

I am not really sure how to move past this, any help or suggestions are appreciated! :)

도움이 되었습니까?

해결책

IN() in Sphinx behaves a little differently to how you're using it - the first argument should be the attribute:

with_delivery = "*, IF(delivery = 1 OR IN(region_id, 1, 2, 3), 1, 0) AS delivery"
Listing.search 'ipod', 
  select: with_delivery, 
  with:   {delivery: 1}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top