Search code examples
mysqlruby-on-railsthinking-sphinx

expected attr type ('uint' or 'timestamp' or 'bigint') in sql_attr_multi


I am trying to reindex on thinking sphinx and I am stuck on this error: source 'user_core_0': expected attr type ('uint' or 'timestamp' or 'bigint') in sql_attr_multi, got 'string zip_city from field'

I am not sure what else I have to change.

ThinkingSphinx::Index.define :user, :with => :active_record do
  # fields
  indexes name, :as => :user, :sortable => true
  indexes religion, zip_code, about_me, career, sexuality, children, user_smoke, user_drink, gender, ethnicity, education


  # attributes
  has id, created_at, updated_at
  has zips.city, :as => :zip_city

  has "RADIANS(zips.lat)",  :as => :latitude,  :type => :float
  has "RADIANS(zips.lon)", :as => :longitude, :type => :float


end

Solution

  • Try changing the attribute

    has zips.city, :as => :zip_city
    

    to

      has "(ZIP)zip.city", :as => :zip_city, :type => :integer