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 2  
3 3 class Article
4 4  
5   - handle_asynchronously :solr_save
6   -
7 5 acts_as_faceted :fields => {
8 6 :solr_plugin_f_type => {:label => _('Type'), :proc => proc{|klass| solr_plugin_f_type_proc(klass)}},
9 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 32 :boost => proc { |a| 10 if a.profile && a.profile.enabled },
35 33 :if => proc{ |a| ! ['RssFeed'].include?(a.class.name) }
36 34  
  35 + handle_asynchronously :solr_save
  36 +
37 37 def solr_plugin_comments_updated
38 38 solr_save
39 39 end
... ...
plugins/solr/lib/ext/category.rb
... ... @@ -2,7 +2,6 @@ require_dependency 'category'
2 2  
3 3 class Category
4 4 after_save_reindex [:articles, :profiles], :with => :delayed_job
5   - handle_asynchronously :solr_save
6 5  
7 6 acts_as_searchable :fields => [
8 7 # searched fields
... ... @@ -15,6 +14,8 @@ class Category
15 14 {:solr_plugin_name_sortable => :string},
16 15 ]
17 16  
  17 + handle_asynchronously :solr_save
  18 +
18 19 private
19 20  
20 21 def solr_plugin_name_sortable
... ...
plugins/solr/lib/ext/product.rb
... ... @@ -2,7 +2,6 @@ require_dependency 'product'
2 2  
3 3 class Product
4 4 after_save_reindex [:enterprise], :with => :delayed_job
5   - handle_asynchronously :solr_save
6 5  
7 6 acts_as_faceted :fields => {
8 7 :solr_plugin_f_category => {:label => _('Related products')},
... ... @@ -43,6 +42,8 @@ class Product
43 42 ], :facets => facets_option_for_solr,
44 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 47 private
47 48  
48 49 def solr_plugin_f_category
... ...
plugins/solr/lib/ext/profile.rb
... ... @@ -2,7 +2,6 @@ require_dependency 'profile'
2 2  
3 3 class Profile
4 4 after_save_reindex [:articles], :with => :delayed_job
5   - handle_asynchronously :solr_save
6 5  
7 6 acts_as_faceted :fields => {
8 7 :solr_plugin_f_enabled => {:label => _('Situation'), :type_if => proc { |klass| klass.kind_of?(Enterprise) },
... ... @@ -32,6 +31,8 @@ class Profile
32 31 ], :facets => facets_option_for_solr,
33 32 :boost => proc{ |p| 10 if p.enabled }
34 33  
  34 + handle_asynchronously :solr_save
  35 +
35 36 class_inheritable_accessor :solr_plugin_extra_index_methods
36 37 self.solr_plugin_extra_index_methods = []
37 38  
... ...