journalduhacker/app/indices/story_index.rb

25 lines
625 B
Ruby
Raw Normal View History

2014-01-07 11:52:29 +01:00
ThinkingSphinx::Index.define :story, :with => :active_record do
indexes description
2014-09-12 17:42:22 +02:00
indexes short_id
2014-01-07 11:52:29 +01:00
indexes tags(:tag), :as => :tags
2014-09-12 17:42:22 +02:00
indexes title
indexes url
indexes user.username, :as => :author
indexes story_cache
2014-01-07 11:52:29 +01:00
has created_at, :sortable => true
has hotness, is_expired
has "(CAST(upvotes as #{Story.votes_cast_type}) - " <<
"CAST(downvotes as #{Story.votes_cast_type}))", :as => :score,
:type => :bigint, :sortable => true
2014-01-07 11:52:29 +01:00
set_property :field_weights => {
:upvotes => 15,
:title => 10,
:story_cache => 10,
2014-01-07 11:52:29 +01:00
:tags => 5,
}
where sanitize_sql(:is_expired => false)
end