ruby on rails,sphinxql:语法错误,意外的QUOTED_STRING,期待CONST_INT或' - '接近''5')和`active` IN('1')AND ...

问题描述 投票:0回答:1

我使用sphinx 3.4.0和rails 5,当我想搜索时我得到了这个错误!

sphinxql: syntax error, unexpected QUOTED_STRING, expecting CONST_INT or '-' near ''5') AND `active` IN ('1') AND .... 

index

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
sql thinking-sphinx ruby-on-rails-5
1个回答
1
投票

看起来你在搜索请求中传入一个字符串 - 可能是一个过滤值? - 它应该是一个整数。思考Sphinx需要将过滤器值转换为适当的类型。

EG

Firm.search "foo", :with => {:account_id => params[:account_id].to_i}

这是一个相对较新的变化,因此旧的文档和示例可能已过时而不是这样做。

© www.soinside.com 2019 - 2024. All rights reserved.