views:

135

answers:

0

Hello:

I have a note table with columns:

  • title :string
  • content :text
  • rating :integer

and a thinking_sphinx configuration:

define_index do
  indexes :title, :sortable => true
  indexes :content
end

Then I can search the notes and assign weights to title and content to define the order or the result:

Note.search "abc", :match_mode => :extended, :field_weights => {
  :title => 10,
  :content => 3
}

Now I want to assign a weight to the rating column

The type of the rating column is integer. The range of the rating is [1, 2, 3, 4, 5].

Can I just add weight at the :field_weights

:field_weights => {
  :title => 10,
  :content => 3,
  :rating => 5
}

or I need to do something else to make the note which has higer rating display first?