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
On Saturday, August 16, 2014 10:22:50 AM UTC-4, Pat Allan wrote: > > Hmm… nothing sounds wrong thus far, so I’m not sure what’s causing this > problem. Can you share your Location index definition? > > On 16 Aug 2014, at 12:52 am, C Wilson <[email protected] <javascript:>> > wrote: > > I was curious as to what's the max return for geo search? > > When I run a location in the console from 600km it say it found 7065 > results from latitude 33.83 and longitude -83.89. That is a Georgia > location. In my database I have 973 total Georgia rows. > > The reason for the post and the issue I have is that 600km = 372 miles > which is a good enough distance to cover the entire state of Georgia from > that lat/lon point. However in the return results it's not showing all the > locations, nor is it giving me locations that are near that max miles it > can reach. For example I have a location that's 255 miles from the lat/lon > point. It should be able to reach it since I have the max distance set to > 600km. > > Is there something else I can do or am I trying to reach out too far? > > def index >> @search = Search.new >> >> if location = Location.find_by_zipcode(params[:search]) >> latitude = location.latitude * Math::PI / 180 >> longitude = location.longitude * Math::PI / 180 >> locations = Location.search( >> :geo => [latitude, longitude], >> :with => {:geodist => 0.0..600_000.0}, >> :order => 'geodist ASC', >> :per_page => 5_000, >> :max_matches => 10_000 >> >> ) >> @users = User.where(zip_code: locations.map(&:zipcode)) > > > > development: >> mysql41: 9312 >> max_matches: 10000 > > > -- > 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] <javascript:>. > To post to this group, send email to [email protected] > <javascript:>. > Visit this group at http://groups.google.com/group/thinking-sphinx. > For more options, visit https://groups.google.com/d/optout. > > > -- 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.
