Multiple Locations

14 views
Skip to first unread message

Carlos Monson

unread,
Mar 5, 2012, 9:30:02 AM3/5/12
to Sunspot
I have a user with multiple locations. And I want to search, a user
near another user in any one of the locations of each of them: the
user searched and the user searching.

It's possible ?

fred.th...@gmail.com

unread,
May 24, 2012, 7:49:03 AM5/24/12
to ruby-s...@googlegroups.com
seems like it's still not possible yet,

I think this is what you wanted to do:

search = Sunspot.search(Location) do
  any_of do
    with(:location).near(13.71, 100.57)
    with(:location).near(13.72, 100.58)
    with(:location).near(13.73, 100.59)
  end
end

currently I believe can only search by one point at the time...

this is how I have my code:

search = Sunspot.search(Location) do
  with(:location).in_radius(lat, lng, 1, :bbox => true)
end

Andy Lindeman

unread,
May 24, 2012, 9:54:07 PM5/24/12
to ruby-s...@googlegroups.com
On Thu, May 24, 2012 at 7:49 AM, <fred.th...@gmail.com> wrote:
> seems like it's still not possible yet,
> see: https://github.com/sunspot/sunspot/issues/227

Yep, that's my mistake in implementation. If anyone has time to
refactor it out so it works with any_of/all_of, I'd definitely merge.

--
Andy Lindeman
http://www.andylindeman.com/
Reply all
Reply to author
Forward
0 new messages