Turns out I was an idiot and forgot to turn my degrees into radians
when *calling* the search method (my 'origin' variable was an array of
lat/lng as google would give it)

However, now I have no results returned whatsoever (even for non-geo
searches). I think it's related to the error when reindexing:

ERROR: index 'venue_core': sql_range_query: ERROR:  column
"venues.latitude" must appear in the GROUP BY clause or be used in an
aggregate function

I've narrowed it down so that commenting out the `has
"RADIANS(latitude/longitude)"...` lines and reindexing makes normal
keyword search work, and uncommenting + reindex breaks all search
again.

Is TS generating invalid SQL and hence never creating any indexes?

On Nov 26, 10:43 am, Bodaniel Jeanes <[email protected]> wrote:
> Hey,
>
> I'm having really weird results when trying to use @geodist.
>
> My setup is pretty standard (I think). I've got a Venue with float lat/
> long columns and I've got my indexes as per the Geo-Searching docs:
>
>   define_index do
>     indexes name, :sortable => true
>
>     has created_at
>
>     has "RADIANS(latitude)",  :as => :latitude,  :type => :float
>     has "RADIANS(longitude)", :as => :longitude, :type => :float
>
>     set_property :delta => true
>   end
>
> However, given the following search in the controller (again, as per
> the docs):
>
>   @venues = Venue.search(search_terms, :geo => origin, :order =>
> "@geodist ASC, @relevance DESC")
>
> The @geodist values (as accessed through sphinx_attributes or via
> each_with_geodist) are incredibly high. If I do a search with an
> origin I know to be about 2km from the nearest venue, the
> corresponding @geodist value is 11752209.0! That value doesn't make
> sense as metres, cm, mm, or even nanometres.
>
> I'm very confused by this as I'm pretty much following the geo-
> searching docs verbatim here.
>
> AFAICT it is still ordering the results correctly (i.e. nearer venues
> have a lower @geodist than far ones).
>
> I'm running sphinx-0.9.9-release, Rails 3.0.3, and TS 2.0.1.
>
> One thing that is possibly related: when I regenerated the sphinx conf
> files after adding the lat/long indexes and reindexed, I got the
> following output:
>
>   ERROR: index 'venue_core': sql_range_query: ERROR:  column
> "venues.latitude" must appear in the GROUP BY clause or be used in an
> aggregate function

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