Sha256: 84be654845ae3b1fb0cd46d761b51c0fc671798ec5d480ffe9c1703770e9882a

Contents?: true

Size: 723 Bytes

Versions: 52

Compression:

Stored size: 723 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,
      :facet => true
    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

52 entries across 52 versions & 12 rubygems

Version Path
sayso-thinking-sphinx-2.0.3.002 features/thinking_sphinx/models/post.rb
sayso-thinking-sphinx-2.0.3.001 features/thinking_sphinx/models/post.rb
thinking-sphinx-2.0.4 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.4.5 features/thinking_sphinx/models/post.rb
thinking-sphinx-2.0.3 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.4.4 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.4.3 features/thinking_sphinx/models/post.rb
thinking-sphinx-2.0.2 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.4.2 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.4.1 features/thinking_sphinx/models/post.rb
joshcutler-thinking-sphinx-1.3.18 features/thinking_sphinx/models/post.rb
thinking-sphinx-2.0.1 features/thinking_sphinx/models/post.rb
thinking-sphinx-2.0.0 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.4.0 features/thinking_sphinx/models/post.rb
thorsson_thinking-sphinx-2.0 features/thinking_sphinx/models/post.rb
angelf-thinking-sphinx-1.3.18 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.3.20 features/thinking_sphinx/models/post.rb
thinking-sphinx-2.0.0.rc2 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.3.19 features/thinking_sphinx/models/post.rb
skalee-thinking-sphinx-1.3.14.2 features/support/models/post.rb