Thinking_sphinx set weighting


#1

Hello,

I’m using Sphinx search engine with thinking_sphinx Ruby on Rails plugin
to interface with it. I use it as follows:
@topics = Topic.search(@search_phrase,
:sphinx => {:limit => $SEARCH_TOPICS_PAGE_COUNT, :page =>
@page,:weights => [100,60,20,20,10]},
:per_page => $SEARCH_TOPICS_PAGE_COUNT, :page => @page)

with indexing code in side topic.rb:
define_index do
indexes title, description
indexes comment.description, :as => :comment_description
indexes poll.poll_question, :as => :poll_question
indexes categories.name, :as => :category_name

has created_at,rating_score

end

it works fine except for weighting! I assume it should give title a
weight of 100 as it’s first description 60 and so on…

When I search it returns good results but it doesn’t sort it very well
according to weighting! so if I have a keyword that exist in one topics
title and another topics comment I want the one with the keyword in the
title to show first. I might be setting the weights in wrong way? any
ideas?

Thanks,

Tam