I have two problems.I am using rails 3.2 and thinking-sphinx and also my application is translateable.I am using I18n for this purpose.So you know i have a table users.They have occupations and the occupations are translateable.I am defining index like the following.
define_index do
indexes occupation,
indexes name,
.....
......
has is_active
set_property :enable_star => 1
set_property :min_infix_len => 3
end
Now i am not sure about how to index the translations of occupations.Secondly i want to priotise my search so that it gives more priority to the occupation than name. Thanks to you in advance.
You can index translations with translations.field_name
.In your case you have to do translations.occupation
to add it in the search index.For the second need you have to set the field weights. Follow this edited code :
define_index do
indexes translations.occupation, :as => :occupation
indexes name, :as => :name
.....
......
has is_active
set_property :enable_star => 1
set_property :min_infix_len => 3
set_property :field_weights => {
:occupation => 2,
:name => 1,
}
end