summaryrefslogtreecommitdiff
path: root/vendor/plugins/thinking-sphinx/features/support/models/post.rb
blob: 430d17c29620a8183dc271a960381fa93f8b5e2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Post < ActiveRecord::Base
  has_many :comments, :dependent => :destroy
  has_many :taggings, :as => :taggable
  has_many :tags, :through => :taggings
  belongs_to :category
  
  define_index do
    indexes subject
    indexes content
    indexes tags.text, :as => :tags
    indexes comments.content, :as => :comments

    has comments(:id), :as => :comment_ids, :source => :ranged_query
    has category.name, :facet => true, :as => :category_name, :type => :string
  end
end