Pat-

Thanks for answering the call.

This made all the diff.

YOU RULE!

Thanks man!
Mark

On Aug 4, 8:53 pm, Pat Allan <[email protected]> wrote:
> Hi Mark
>
> I've not heard of this problem before - mind you, I've never used 
> thegeosearch in an app myself. It's really odd that it works if you're not 
> converting the args to radians... which leads me to wonder: are you certain 
> the lat/lng values in @geo_location aren't radians already?
>
> Oh wait... (sorry, figuring this out as I type, too lazy to edit appropiately 
> ;) - you've got the original lat/lng in there, as well as the converted 
> versions. I realise you need a reference to address in there to keep the 
> join, but I've added something for that recently.
>
> So, instead of:
>
>   has address.lat, address.lng
>
> Try:
>
>   join address
>
> (This was only added in 1.3.18)
>
> I'm wondering if Thinking Sphinx is getting confused between the lat/lng and 
> latitute/longitude attributes.
>
> Hope this helps.
>
> --
> Pat
>
> On 02/08/2010, at 3:17 AM, mark wrote:
>
> > Hi Pat, et al,
>
> > I am using Thinking Sphinx for ageosearch of a large location
> > database with multiple assocs.
>
> > I am storing my lat/lngs as decimals in a postgres database. All of
> > this stuff works nicely with GeoKit.
>
> > Anyway, I really like the way TS searches and now that I have thegeo
> > stuff (sort of ) working I wanted to post a message about some
> > interesting things I am seeing...
>
> > First, when I convert from the floating point val from postgres to
> > radians using the simple mixin:
>
> > class Numeric
> >  def to_radians
> >    ( self / 360.0 ) * Math::PI * 2
> >  end
> > end
>
> > and add it to my search like such:
>
> > @records = Location.search(@search_terms,
> >      #:geo=> [...@geo_location[:lat].to_f.to_radians,
> > @geo_location[:lng].to_f.to_radians ],
>
> > I get records way off. I am in mission viejo and the location records
> > that are coming back are in LA...
>
> > However, when I remove the .to_radians and just pass in the floating
> > point value for the lat/lng I get stuff very nearby...
>
> > WIERD?
>
> > So I am just not sure what is going on as the documentation says to
> > convert lat/lng to radian.
>
> > The distance is also way off... I know it is in meters so I am
> > converting it to miles using alchemist:
>
> > organic_map_popup.sphinx_attributes['@geodist'].meters.to.miles
>
> > but it is still coming up 300 miles off!!
>
> > my query looks something like this:
>
> >     �...@distance_in_miles_to_search = 300.miles.to.meters.value.to_f
>
> >     �...@records = Location.search(@search_terms,
> >      #:geo=> [...@geo_location[:lat].to_f.to_radians,
> > @geo_location[:lng].to_f.to_radians ],
> >      :geo=> [...@geo_location[:lat].to_f, @geo_location[:lng].to_f ],
> >      :order => "@geodist ASC, @relevance DESC",
> >      :include => [:business, :address],
>
> >      :field_weights => {
> >        :tags => 9,
> >        :name => 10,
> >        :category => 8 },
>
> >      :with => {"@geodist" => 0....@distance_in_miles_to_search})
>
> > If I change that to 30 miles it comes up with nothing...
>
> > here is the define index on the searchable model:
>
> >    define_index do
>
> >    indexes business.name
> >    indexes tags.name, :as => :tags
>
> >    indexes business.categories.name
>
> >    has address.lat, address.lng
>
> >    has "RADIANS(addresses.lat)",  :as => :latitude,  :type => :float
> >    has "RADIANS(addresses.lng)",  :as => :longitude, :type => :float
>
> >  end
>
> > Anyway, I love thinking sphinx, but I just have never been able to use
> > it correctly withgeosearching...
>
> > I am using:
> > rails 2.3.8
> > ruby 1.8.7 (ubuntu linux)
> > thinking-sphinx (1.3.18)
> > sphinx-0.9.9
>
> > Any help would be totally appreciated!
>
> > All the best,
> > Mark McDonald
>
> > --
> > 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 
> > athttp://groups.google.com/group/thinking-sphinx?hl=en.

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