Is there a way I can do that: I want to retrieve Users which:

-are situated in a maximum distance of origin point (lat/long)
OR
-have a mobility_city defined 

I defined:
Class User
    define_index do
        indexes "'nothing'", :as => :empty
        has mobilities.city_id, :as => :mobile_cities_ids
        has "RADIANS(users.latitude)",  :as => :latitude,  :type => :float
        has "RADIANS(users.longitude)", :as => :longitude, :type => :float
    end
end

Of course I can do 2 differents call and then merge them:

@users_distance = User.search :with => {:mobile_cities_ids => @ville.id }
@users_mobiles = User.search :geo => [@lat, @lng], :with => {"@geodist" => 
0.0..10_000.0}
@both= (@users_distance + @users_mobiles).uniq

but with this approach i loose the ability to retrieve facets directly : 
@both.facets => can't retrieve on an array...

I could do something like that then @facets = User.facets :with => 
{:user_id => @both.map(&:id) }, but isn't it a bit heavy ?

Any suggestion ?

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/thinking-sphinx/-/yERuG8f8ywQJ.
To post to this group, send email to thinking-sphinx@googlegroups.com.
To unsubscribe from this group, send email to 
thinking-sphinx+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to