From c8e5aa3cac2ffd65218380add016168bbdade8dc Mon Sep 17 00:00:00 2001 From: joshua stein Date: Thu, 19 Dec 2013 16:03:04 -0600 Subject: [PATCH] sphinx casts integers to unsigned, screwing up score attributes cast them as bigints closes #67 --- app/models/comment.rb | 4 ++-- app/models/story.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/comment.rb b/app/models/comment.rb index c93347a..e11333c 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -28,8 +28,8 @@ class Comment < ActiveRecord::Base indexes comment indexes user.username, :as => :author - has "(upvotes - downvotes)", :as => :score, :type => :integer, - :sortable => true + has "(cast(upvotes as signed) - cast(downvotes as signed))", + :as => :score, :type => :bigint, :sortable => true has is_deleted has created_at diff --git a/app/models/story.rb b/app/models/story.rb index d0b6556..974aed2 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -33,8 +33,8 @@ class Story < ActiveRecord::Base has created_at, :sortable => true has hotness, is_expired - has "(cast(upvotes as int) - cast(downvotes as int))", - :as => :score, :type => :integer, :sortable => true + has "(cast(upvotes as signed) - cast(downvotes as signed))", + :as => :score, :type => :bigint, :sortable => true set_property :field_weights => { :upvotes => 15,