Forum: Ruby on Rails Thinking_sphinx set weighting

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Tam K. (Guest)
on 2008-10-11 23:09

I'm using Sphinx search engine with thinking_sphinx Ruby on Rails plugin
to interface with it. I use it as follows:
    @topics =,
              :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, :as => :category_name

    has created_at,rating_score

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


This topic is locked and can not be replied to.