Ah, yes sounds good. Thank you! On Jul 12, 8:12 pm, Pat Allan <[email protected]> wrote: > Hi Keith > > Unfortunately, Sphinx has no concept of arrays of floats, so this will not > work. > > What you'll need to do is to have an index on Location instead, and group by > thing_id: > > define_index do > # you need at least one field. > indexes thing.name, :as => :thing > has lat, lng, thing_id > end > > Location.search 'foo', > :geo => [lat, lng], > :group_by => 'thing_id', > :group_function => :attr > > You can add :group_clause to manage how the search results are sorted - the > normal sorting applies within each group (ie: which location for the matching > thing_id is > returned).http://freelancing-god.github.com/ts/en/searching.html#grouping > > This will ensure you only have one result per thing. > > Cheers > > -- > Pat > > On 13/07/2010, at 1:42 AM, Keith wrote: > > > > > Say I have something like this: > > > class Thing < ActiveRecord::Base > > has_many :locations > > > define_index do > > has 'locations.lat', :as => :latitude > > has 'locations.lng', :as => :longitude > > end > > > end > > > class Location < ActiveRecord::Base > > acts_as_mappable > > belongs_to :thing > > end > > > Would a has_many on locations ever be able to be correctly indexed/ > > queried across? What would the right approach for this be? Thanks. > > > -- > > 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.
