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,