It's certainly possible - have a look at the docs here:
http://freelancing-god.github.com/ts/en/common_issues.html#or_attributes

I'd recommend creating a manual attribute for any_cities with a SQL snippet 
(like you're doing with lat/lng attributes) which returns a boolean value.

  has "…", :as => :any_cities, :type => :boolean

-- 
Pat

On 26/06/2012, at 8:21 PM, deneuxa wrote:

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



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