I have a post model that had an index setup..  Originally the post
model had columns for location data (city, state, country, lat, lng,
etc).  I just created a location model and gave post a has_one
association for that (location is polymorphic though so it has
locationable_type and locationable_id columns).  So my post.rb has
this:

has_one  :location, :as => :locationable

So next i needed to replace the code in defined_index from:

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

to

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

.. but I get these two errors:
indexing index 'post_core'...
ERROR: index 'post_core': sql_range_query: Unknown column
'locations.lng' in 'field list'
indexing index 'post_delta'...
ERROR: index 'post_delta': sql_range_query: Unknown column
'locations.lng' in 'field list'

Which I am assuming because of the polymorphic nature of location with
its locationable_type and locationable_id stuff...

Can anyone point me in the right direction with this?

-patrick

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to