Sorting in multiple classes

Hi !

I've the following search command:
ThinkingSphinx.search '', :classes => [MedicalCenter, Doctor], :order => "name_sort"

And these are my indexes:

In Doctor Model

define_index do

indexes [:last_name, :first_name], as: :name, sortable: true
indexes city(:name), as: :city_name
indexes city.state(:name), as: :city_state_name
indexes specialties.translations(:name), as: :specialty_name
where sanitize_sql(['enabled', true]) # Don't load disabled results

end

In MedicalCenter model

define_index do indexes :name, sortable: true

indexes city(:name), as: :city_name
indexes city.state(:name), as: :city_state_name
indexes specialties.translations(:name), as: :specialty_name
where sanitize_sql(['enabled', true]) # Don't load disabled results

end

In my local env it works ok, the results were ordered by name (independently of the model).
But, in heroku env the results show doctors and medical centers interspersed (one doctor, one medical center, one doctor .....)
Doctors and medical centers were ordered by name, but not the complete result.

I tried to use :rank_mode and :sort_mode, but nothing

Can you please, give me an advice fot this issue ?
Thanks

Damian

  1. Hi Damian

    What version of Sphinx do you have installed locally? And do you know what version of Sphinx you're using on Flying Sphinx? (I can check if you let me know your app's name.) The behaviour you're seeing on production sounds like what an older version of Sphinx would do (1.10, most likely).

    Cheers

    Pat

  2. Hi Pat

    My local version is Sphinx 2.0.6-release (r3473)
    And the application is southdoctors-production.herokuapp.com

    Thanks !
    Damian

  3. Right - if you set the Sphinx version in your config/sphinx.yml file for your production (and staging, if that's on Heroku and using Flying Sphinx) to 2.0.6, and then run the fs:rebuild rake task (or flying-sphinx configure), your app will change to using Sphinx 2.0.6 instead of 1.10 on your FS server.

    Give that a spin, let me know how you go :)

    Pat

  4. Great Pat, it works ok.

    Thanks for your time !

    Cheers,
    Damian

  5. Great to hear :)

  6. Pat Allan closed this discussion on 15 Feb, 2013 10:17 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions