cirandas.net

ref: master

plugins/solr/lib/ext/comment.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
require_dependency 'comment'

ActiveSupport.run_load_hooks :solr_comment

class Comment

  after_save :solr_notify_article
  after_destroy :solr_notify_article

  def solr_notify_article
    article.solr_comments_updated if article.kind_of?(Article)
  end

  extend SolrPlugin::ActsAsSearchable

  acts_as_searchable fields: SEARCHABLE_FIELDS.map{ |field, options|
    {field => {boost: options[:weight]}}
  }

end