Commit 9748aa6b1f1789ad98446781f958e154b7432086

Authored by Rafael Martins
1 parent 334a0687

Two fixes for Product model

* after_save_reindex associated enterprises
* index category_full_name for searching
Showing 1 changed file with 2 additions and 1 deletions   Show diff stats
app/models/product.rb
@@ -274,7 +274,7 @@ class Product < ActiveRecord::Base @@ -274,7 +274,7 @@ class Product < ActiveRecord::Base
274 acts_as_searchable :fields => facets_fields_for_solr + [ 274 acts_as_searchable :fields => facets_fields_for_solr + [
275 # searched fields 275 # searched fields
276 {:name => {:type => :text, :boost => 2.0}}, 276 {:name => {:type => :text, :boost => 2.0}},
277 - {:description => :text}, 277 + {:description => :text}, {:category_full_name => :text},
278 # filtered fields 278 # filtered fields
279 {:public => :boolean}, {:environment_id => :integer}, 279 {:public => :boolean}, {:environment_id => :integer},
280 {:category_filter => :integer}, 280 {:category_filter => :integer},
@@ -291,5 +291,6 @@ class Product < ActiveRecord::Base @@ -291,5 +291,6 @@ class Product < ActiveRecord::Base
291 ], :facets => facets_option_for_solr, 291 ], :facets => facets_option_for_solr,
292 :boost => proc{ |p| boost = 1; Boosts.each{ |b| boost = boost * (1 - ((1 - b[2].call(p)) * b[1])) }; boost} 292 :boost => proc{ |p| boost = 1; Boosts.each{ |b| boost = boost * (1 - ((1 - b[2].call(p)) * b[1])) }; boost}
293 handle_asynchronously :solr_save 293 handle_asynchronously :solr_save
  294 + after_save_reindex [:enterprise], :with => :delayed_job
294 295
295 end 296 end