Hi Aninda

Firstly, you'll need to ensure the association is referenced somewhere  
in your index setup:
   has location(:id), :as => :location_id

And then you can add custom SQL snippets for generating lat and lng in  
radians:
   has 'RADIANS(location.lat)', :as => :lat, :type => :float
   has 'RADIANS(location.lng)', :as => :lng, :type => :float

Cheers

-- 
Pat

On 28/07/2009, at 2:52 PM, Aninda wrote:

>
> Hi,
>  I also have the geocode attributes stored in an association model,
> but they are stored in decimal degrees:
> How would I then convert these attributes into radians for ts?
>  has location(:lat), :as => :latit
>  has location(:lng), :as => :longit
>
> Thanks!
>
> On Jul 24, 1:57 pm, Pat Allan <[email protected]> wrote:
>> Hi John
>>
>> What you're doing should work... how are you searching on your
>> CoffeeShop model? And are the columns in your locations table storing
>> lat and lng in radians?
>>
>> --
>> Pat
>>
>> On 23/07/2009, at 5:51 PM, DB_John wrote:
>>
>>
>>
>>
>>
>>> Can the geocode attributes of a model be set to attributes from an
>>> associated model?
>>
>>> I have a CoffeeShop model that stores its location information in a
>>> Location model.  I've been trying different versions of the  
>>> following
>>> to no success:
>>
>>>  define_index do
>>>    has location(:lat), :as => :latit
>>>    has location(:lng), :as => :longit
>>
>>>    set_property :latitude_attr   => :latit
>>>    set_property :longitude_attr  => :longit
>>>  end
>>
>>> Do I need to explicitly add those lat/lng columns to my CoffeeShop
>>> table?
>>
>>> Thanks,
>>> John
> >


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