Sha256: 1a7f754e7da840126af416eb033a4441bda20a68480f1f34b6e9db2a4c2b8856

Contents?: true

Size: 1.01 KB

Versions: 15

Compression:

Stored size: 1.01 KB

Contents

# common base class for Content and SpecialContent
class ContentBase < ActiveRecord::Base
  set_table_name 'contents'

  # a higher boost means more importance for the field --> documents having a
  # match in a field with a higher boost value will be ranked higher
  #
  # we use the store_class_name flag to be able to retrieve model instances when
  # searching multiple indexes at once.
  # the contents of the description field are stored in the index for running
  # 'more like this' queries to find other content instances with similar
  # descriptions
  acts_as_ferret( :fields => { :comment_count => { :index => :untokenized },
                               :title         => { :boost => :title_boost }, 
                               :description   => { :boost => 1, :store => :yes },
                               :special       => {} },
                  :boost => :record_boost)

  def comment_count; 0 end

  attr_accessor :record_boost
  attr_writer :title_boost
  def title_boost
    @title_boost || 2
  end
end


Version data entries

15 entries across 15 versions & 4 rubygems

Version Path
cehoffman-acts_as_ferret-0.4.4 doc/demo/app/models/content_base.rb
jkraemer-acts_as_ferret-0.4.4 doc/demo/app/models/content_base.rb
acts_as_ferret-0.5.4 doc/demo/app/models/content_base.rb
acts_as_ferret-0.5.3 doc/demo/app/models/content_base.rb
watson-acts_as_ferret-0.4.8.2 doc/demo/app/models/content_base.rb
acts_as_ferret-0.5.2 doc/demo/app/models/content_base.rb
acts_as_ferret-0.4.8.2 doc/demo/app/models/content_base.rb
acts_as_ferret-0.4.8.1 doc/demo/app/models/content_base.rb
acts_as_ferret-0.5.1 doc/demo/app/models/content_base.rb
acts_as_ferret-0.5 doc/demo/app/models/content_base.rb
acts_as_ferret-0.4.8.rails3 doc/demo/app/models/content_base.rb
acts_as_ferret-0.4.8 doc/demo/app/models/content_base.rb
acts_as_ferret-0.4.7 doc/demo/app/models/content_base.rb
acts_as_ferret-0.4.6 doc/demo/app/models/content_base.rb
acts_as_ferret-0.4.4 doc/demo/app/models/content_base.rb