Commit be8867663ab9ab5e5437b6377b8b3b87c870d512

Authored by Rodrigo Souto
1 parent 9480ac71

[pluginize-solr] Handle async must come after acts_as_searchable

plugins/solr/lib/ext/article.rb
@@ -2,8 +2,6 @@ require_dependency 'article' @@ -2,8 +2,6 @@ require_dependency 'article'
2 2
3 class Article 3 class Article
4 4
5 - handle_asynchronously :solr_save  
6 -  
7 acts_as_faceted :fields => { 5 acts_as_faceted :fields => {
8 :solr_plugin_f_type => {:label => _('Type'), :proc => proc{|klass| solr_plugin_f_type_proc(klass)}}, 6 :solr_plugin_f_type => {:label => _('Type'), :proc => proc{|klass| solr_plugin_f_type_proc(klass)}},
9 :solr_plugin_f_published_at => {:type => :date, :label => _('Published date'), :queries => {'[* TO NOW-1YEARS/DAY]' => _("Older than one year"), 7 :solr_plugin_f_published_at => {:type => :date, :label => _('Published date'), :queries => {'[* TO NOW-1YEARS/DAY]' => _("Older than one year"),
@@ -34,6 +32,8 @@ class Article @@ -34,6 +32,8 @@ class Article
34 :boost => proc { |a| 10 if a.profile && a.profile.enabled }, 32 :boost => proc { |a| 10 if a.profile && a.profile.enabled },
35 :if => proc{ |a| ! ['RssFeed'].include?(a.class.name) } 33 :if => proc{ |a| ! ['RssFeed'].include?(a.class.name) }
36 34
  35 + handle_asynchronously :solr_save
  36 +
37 def solr_plugin_comments_updated 37 def solr_plugin_comments_updated
38 solr_save 38 solr_save
39 end 39 end
plugins/solr/lib/ext/category.rb
@@ -2,7 +2,6 @@ require_dependency 'category' @@ -2,7 +2,6 @@ require_dependency 'category'
2 2
3 class Category 3 class Category
4 after_save_reindex [:articles, :profiles], :with => :delayed_job 4 after_save_reindex [:articles, :profiles], :with => :delayed_job
5 - handle_asynchronously :solr_save  
6 5
7 acts_as_searchable :fields => [ 6 acts_as_searchable :fields => [
8 # searched fields 7 # searched fields
@@ -15,6 +14,8 @@ class Category @@ -15,6 +14,8 @@ class Category
15 {:solr_plugin_name_sortable => :string}, 14 {:solr_plugin_name_sortable => :string},
16 ] 15 ]
17 16
  17 + handle_asynchronously :solr_save
  18 +
18 private 19 private
19 20
20 def solr_plugin_name_sortable 21 def solr_plugin_name_sortable
plugins/solr/lib/ext/product.rb
@@ -2,7 +2,6 @@ require_dependency 'product' @@ -2,7 +2,6 @@ require_dependency 'product'
2 2
3 class Product 3 class Product
4 after_save_reindex [:enterprise], :with => :delayed_job 4 after_save_reindex [:enterprise], :with => :delayed_job
5 - handle_asynchronously :solr_save  
6 5
7 acts_as_faceted :fields => { 6 acts_as_faceted :fields => {
8 :solr_plugin_f_category => {:label => _('Related products')}, 7 :solr_plugin_f_category => {:label => _('Related products')},
@@ -43,6 +42,8 @@ class Product @@ -43,6 +42,8 @@ class Product
43 ], :facets => facets_option_for_solr, 42 ], :facets => facets_option_for_solr,
44 :boost => proc{ |p| boost = 1; SolrPlugin::Boosts.each{ |b| boost = boost * (1 - ((1 - b[2].call(p)) * b[1])) }; boost} 43 :boost => proc{ |p| boost = 1; SolrPlugin::Boosts.each{ |b| boost = boost * (1 - ((1 - b[2].call(p)) * b[1])) }; boost}
45 44
  45 + handle_asynchronously :solr_save
  46 +
46 private 47 private
47 48
48 def solr_plugin_f_category 49 def solr_plugin_f_category
plugins/solr/lib/ext/profile.rb
@@ -2,7 +2,6 @@ require_dependency 'profile' @@ -2,7 +2,6 @@ require_dependency 'profile'
2 2
3 class Profile 3 class Profile
4 after_save_reindex [:articles], :with => :delayed_job 4 after_save_reindex [:articles], :with => :delayed_job
5 - handle_asynchronously :solr_save  
6 5
7 acts_as_faceted :fields => { 6 acts_as_faceted :fields => {
8 :solr_plugin_f_enabled => {:label => _('Situation'), :type_if => proc { |klass| klass.kind_of?(Enterprise) }, 7 :solr_plugin_f_enabled => {:label => _('Situation'), :type_if => proc { |klass| klass.kind_of?(Enterprise) },
@@ -32,6 +31,8 @@ class Profile @@ -32,6 +31,8 @@ class Profile
32 ], :facets => facets_option_for_solr, 31 ], :facets => facets_option_for_solr,
33 :boost => proc{ |p| 10 if p.enabled } 32 :boost => proc{ |p| 10 if p.enabled }
34 33
  34 + handle_asynchronously :solr_save
  35 +
35 class_inheritable_accessor :solr_plugin_extra_index_methods 36 class_inheritable_accessor :solr_plugin_extra_index_methods
36 self.solr_plugin_extra_index_methods = [] 37 self.solr_plugin_extra_index_methods = []
37 38