[英]ruby on rails , sphinxql: syntax error, unexpected QUOTED_STRING, expecting CONST_INT or '-' near ''5') AND `active` IN ('1') AND …
I use sphinx 3.4.0 and rails 5, when i want to search i got this error !! 我使用狮身人面像3.4.0和Rails 5,当我想搜索时遇到了这个错误!
sphinxql: syntax error, unexpected QUOTED_STRING, expecting CONST_INT or '-' near ''5') AND `active` IN ('1') AND ....
ThinkingSphinx::Index.define :firm, with: :active_record do
# fields
indexes corporate_name, :sortable => true, :as => :rs
indexes [addresses.city.region.name, addresses.free_region], :as => :wilaya
indexes [addresses.street_1, addresses.street_2, addresses.street_3], :as => :adresse
end
It looks like you're passing in a string in your search request - perhaps as a filter value? 看起来您在搜索请求中传递了一个字符串-也许作为过滤器值? - when it should be an integer.
-应该为整数时。 Thinking Sphinx requires filter values to be cast as their appropriate types.
思维狮身人面像要求将过滤器值转换为适当的类型。
eg 例如
Firm.search "foo", :with => {:account_id => params[:account_id].to_i}
This is a relatively recent change, so old documentation and examples may be out-of-date and not do this. 这是一个相对较新的更改,因此旧的文档和示例可能已过时并且不这样做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.