Sha256: 5576921f975381f0549e1bf8deb5f2b81c7c754892ca560cd2feb24560f883b1

Contents?: true

Size: 782 Bytes

Versions: 29

Compression:

Stored size: 782 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
    indexes keywords_file, :as => :keywords, :file => true
    
    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

29 entries across 29 versions & 2 rubygems

Version Path
friendlyfashion-thinking-sphinx-2.0.14.4 features/thinking_sphinx/models/post.rb
friendlyfashion-thinking-sphinx-2.0.14.3 features/thinking_sphinx/models/post.rb
thinking-sphinx-2.1.0 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.5.0 features/thinking_sphinx/models/post.rb
friendlyfashion-thinking-sphinx-2.0.14.2 features/thinking_sphinx/models/post.rb
friendlyfashion-thinking-sphinx-2.0.14.1 features/thinking_sphinx/models/post.rb
thinking-sphinx-2.0.14 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.4.14 features/thinking_sphinx/models/post.rb
friendlyfashion-thinking-sphinx-2.0.13.3 features/thinking_sphinx/models/post.rb
friendlyfashion-thinking-sphinx-2.0.13.2 features/thinking_sphinx/models/post.rb
friendlyfashion-thinking-sphinx-2.0.13.1 features/thinking_sphinx/models/post.rb
friendlyfashion-thinking-sphinx-2.0.13 features/thinking_sphinx/models/post.rb
thinking-sphinx-2.0.13 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.4.13 features/thinking_sphinx/models/post.rb
thinking-sphinx-2.0.12 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.4.12 features/thinking_sphinx/models/post.rb
thinking-sphinx-2.0.11 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.4.11 features/thinking_sphinx/models/post.rb
thinking-sphinx-2.0.10 features/thinking_sphinx/models/post.rb
thinking-sphinx-1.4.10 features/thinking_sphinx/models/post.rb