PS: same result with direct facet search of course :
 @facets = HomeService.facets with: {geodist: 0.0..10_000.0}, geo: [float1, 
float2]




Le mercredi 6 novembre 2013 22:05:49 UTC+1, deneuxa a écrit :
>
> Hello Pat,
>
> I'm upgrading my app to V3 and can't find how to use facts.
>
> On V2 I was doing  
> @users= HomeService.search with: {geodist: 0.0..10_000.0}, geo: [float1, 
> float2]
> @facets = @users.facets
>
> and then in my view (HAML syntax) :
> [email protected] do |facet, facet_options|
>   - %h5= facet
>   -  %ul
>     -facet_options.each do |option, count|
>       -%li= link_to "#{option} (#{count})" (...)
>
> With V3, I can't, it render me nothing :s
>
> @facets.inspect give me :
>
> <ThinkingSphinx::FacetSearch:0x007f9dda4947e0 
> @options={:with=>{:geodist=>0.0..10000000.0}, :geo=>[0.851670060424925, 
> 0.03767031391041961], :classes=>[HomeService(id: integer, type: string, 
> user_id: string, state: integer, (...)  child_diplome: boolean, 
> child_speak_1: string (...) home_cook: boolean, home_shopping: boolean 
> (...), email_alert: boolean, delta: boolean)]}, @query="", @hash={}>
>
> Could it be because of the STI structure of my app ?
>
> I have those 3 models :
> class Service < ActiveRecord::Base
> class HomeService < Service
> class ChildService < Service.
>
> I defined the indices on HomeService and ChildService models like this :
>
> ThinkingSphinx::Index.define :home_service, with: :active_record, delta: 
> ThinkingSphinx::Deltas::DelayedDelta do
>   join user
>   has 'state = 1 AND users.banned_at IS NULL and users.email_verified_at 
> IS NOT NULL', as: :searchable, type: :boolean
>   has 'RADIANS(users.geo_latitude)', as: :latitude, type: :float
>   has 'RADIANS(users.geo_longitude)', as: :longitude, type: :float
>   has user.car_license, as: :user_car_license, type: :boolean, facet: true
>   has user.car_owner, as: :user_car_owner, type: :boolean, facet: true
>   (...)
>   has home_cook, facet: true
>   (...)
> end
>
> I tried a @facets.to_hash but it raise me *"Using the old-fashion 
> @variables (@count, @weight, etc.) is deprecated"*
> *
> *
>
> Can you please give me a hand with that ?
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to