Sha256: a1f7ffbb41e32f93495d0c3f894c60f9b8fefeecb13844a4d4141ced101886d3

Contents?: true

Size: 701 Bytes

Versions: 15

Compression:

Stored size: 701 Bytes

Contents

class Post < ActiveRecord::Base
  has_many :comments, :dependent => :destroy
  has_many :taggings, :as => :taggable
  has_many :tags, :through => :taggings
  belongs_to :category
  has_and_belongs_to_many :authors
  
  define_index do
    indexes subject
    indexes content
    indexes tags.text, :as => :tags
    indexes comments.content, :as => :comments
    indexes authors.name, :as => :authors
    
    has comments(:id), :as => :comment_ids, :source => :ranged_query
    has category.name, :facet => true, :as => :category_name, :type => :string
    has 'COUNT(DISTINCT comments.id)', :as => :comments_count, :type => :integer
    has comments.created_at, :as => :comments_created_at
  end
end

Version data entries

15 entries across 15 versions & 4 rubygems

Version Path
thinking-sphinx-1.3.6 features/support/models/post.rb
thinking-sphinx-1.3.4 features/support/models/post.rb
thinking-sphinx-1.3.3 features/support/models/post.rb
thinking-sphinx-099-1.3.2 features/support/models/post.rb
thinking-sphinx-1.3.2 features/support/models/post.rb
moneypools-thinking-sphinx-1.3.1 features/support/models/post.rb
thinking-sphinx-1.3.1 features/support/models/post.rb
thinking-sphinx-099-1.3.1 features/support/models/post.rb
thinking-sphinx-099-1.3.0 features/support/models/post.rb
thinking-sphinx-1.3.0 features/support/models/post.rb
thinking-sphinx-099-1.2.13 features/support/models/post.rb
thinking-sphinx-1.2.13 features/support/models/post.rb
moneypools-thinking-sphinx-1.2.13 features/support/models/post.rb
moneypools-thinking-sphinx-1.2.12 features/support/models/post.rb
warp-thinking-sphinx-1.2.12 features/support/models/post.rb