I need to covert degrees to radians for both the User and Locations index. The conversion is working beautifully for Location index. The trouble I am having is with the User index. Since the User model does not store latitude and longitude, I created a relationship between the two tables in the User model by doing:
def latitude > location = Location.find_by_zip_code(zip_code) > if location > location.latitude > end > end Below is the location and user index. I have this error when I perform a search "index user_core: parse error: Sphinx expr: syntax error, unexpected TOK_IDENT near 'latitude, longitude)'". The error disappears when I remove the conversion from the Users index, and instead I get `undefined method `inject' for nil:NilClass`. Which I figured inject error is due to not having the conversion setup. ThinkingSphinx::Index.define :location, :with => :active_record do > indexes city > > has "RADIANS(locations.latitude)", :as => :latitude, :type => :float > has "RADIANS(locations.longitude)", :as => :longitude, :type => :float > end > ThinkingSphinx::Index.define :user, :with => :active_record do > indexes name, :as => :user, :sortable => true > has "RADIANS(User.locations.latitude)", :as => :latitude, :type => > :float > has "RADIANS(User.locations.longitude)", :as => :longitude, :type => > :float > has(:zip_code, :as => :zip_code, :type => :integer) > end -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/thinking-sphinx. For more options, visit https://groups.google.com/d/optout.
