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 Posted by Pat Allan Support staff on 14 Feb, 2013 07:54 PM
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 Posted by Damian Moretti on 14 Feb, 2013 08:02 PM
Hi Pat
My local version is Sphinx 2.0.6-release (r3473)
And the application is southdoctors-production.herokuapp.com
Thanks !
Damian
#3 Posted by Pat Allan Support staff on 14 Feb, 2013 08:08 PM
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 Posted by Damian Moretti on 15 Feb, 2013 01:46 PM
Great Pat, it works ok.
Thanks for your time !
Cheers,
Damian
#5 Posted by Pat Allan Support staff on 15 Feb, 2013 10:17 PM
Great to hear :)
Pat Allan closed this discussion on 15 Feb, 2013 10:17 PM.