简体   繁体   中英

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 !!

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM