use cast() magic when passing score to sphinx

fixes problem with mysql/mariadb 5.5
This commit is contained in:
joshua stein 2013-06-24 13:02:55 -05:00
parent 78603d8349
commit 7ff7b676e5

View file

@ -32,10 +32,11 @@ class Story < ActiveRecord::Base
has created_at, :sortable => true
has hotness, is_expired
has "(upvotes - downvotes)", :as => :score, :type => :integer,
:sortable => true
has "(cast(upvotes as int) - cast(downvotes as int))",
:as => :score, :type => :integer, :sortable => true
set_property :field_weights => {
:upvotes => 15,
:title => 10,
:tags => 5,
}