I rewrited my problem to be more explicit and post it on stackoverflow too :

http://stackoverflow.com/questions/19874448/how-to-use-facets-with-thinking-sphinx-v3


*With V3, I can't display facets :s :*

I use Rails 4.0.1, thinking-sphinx (3.0.6), and sphinx was recently 
installed on MacOS 10.9 with 'brew install sphinx --mysql'

I defined my index this way :

ThinkingSphinx::Index.define :user, with: :active_record, delta: 
ThinkingSphinx::Deltas::DelayedDelta do

  #attributes
  has 'users.banned_at IS NULL and users.email_verified_at IS NOT NULL', as: 
:searchable, type: :boolean, facet: true
  has 'RADIANS(geo_latitude)', as: :latitude, type: :float
  has 'RADIANS(geo_longitude)', as: :longitude, type: :float

  has gender, facet: trueend

in my controller :

@users = User.search with: {geodist: 0.0..100_000.0},
                         geo: [City.first.latitude, 
City.first.longitude]@facets = @users.facets

and then in my view (HAML syntax) the same code as V2, which render me 
nothing :

[email protected] do |facet, facet_options|
  - %h5= facet
  -  %ul
    -facet_options.each do |option, count|
      -%li= link_to "#{option} (#{count})" (...)

@facets.inspect give me this :

{:geodist=>0.0..100000000.0}, :geo=>[46.15, 4.91667], :classes=>[User(id: 
integer, gender: integer, name: string, family_name: string, email: string, 
crypt_pass: string, salt: string, auth_token: string, verif_token: string, 
password_reset_token: string, password_reset_sent_at: datetime, city_id: 
integer, oauth_provider: string, oauth_uid: integer, oauth_token: string, 
oauth_expires_at: datetime, last_login_at: datetime, banned_at: boolean, 
created_at: datetime, updated_at: datetime, schedule_mon_0: boolean, 
schedule_mon_1: boolean, (...) schedule_available_holidays: boolean, 
destroyed_email: string, destroyed_at: datetime, birthday: date, 
mobility_km: integer, geo_search: string, geo_latitude: float, 
geo_longitude: float, geo_streetnumber: string, geo_route: string, 
geo_locality: string, geo_postal_code: string, 
geo_administrative_area_level_2: string, geo_administrative_area_level_1: 
string, geo_country: string, geo_type: string, email_verified_at: 
datetime)]}, @query="", @hash={}>

I tried to make @facets.to_hash but it give me this error :

Using the old-fashion @variables (@count, @weight, etc.) is deprecated

I'm stuck with this problem, many thanks for your help !

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