按类别过滤在狂欢太阳黑子搜索中不起作用
Filter by category is not working in spree sunspot search
我在 spree sunspot(solr) 搜索中遇到问题。
按价格过滤是工作文件,但在按类别过滤时出现问题。
我正在使用
rails- 4.1.6,
ruby 2.2.0,
spree_sunspot (1.3)
spree_sunspot.rb
string :category_names, :multiple => true do
category = Spree::Taxon.find_by_permalink('categories')
taxons.select{|t| t.ancestors.include?(category)}.collect{|t| t.self_and_ancestors.map(&:name)}.flatten - [category.name]
end
spree_sunspot_filters.rb
filters.add do |f|
f.display_name = 'Category'
f.search_condition = :any
f.search_param = 'category_name'
f.values { Spree::Taxon.find_by_permalink('categories').children.map(&:name) }
end
我已经解决了重建索引页面的问题,它工作正常。
rake sunspot:reindex
我在 spree sunspot(solr) 搜索中遇到问题。
按价格过滤是工作文件,但在按类别过滤时出现问题。
我正在使用 rails- 4.1.6, ruby 2.2.0, spree_sunspot (1.3)
spree_sunspot.rb
string :category_names, :multiple => true do
category = Spree::Taxon.find_by_permalink('categories')
taxons.select{|t| t.ancestors.include?(category)}.collect{|t| t.self_and_ancestors.map(&:name)}.flatten - [category.name]
end
spree_sunspot_filters.rb
filters.add do |f|
f.display_name = 'Category'
f.search_condition = :any
f.search_param = 'category_name'
f.values { Spree::Taxon.find_by_permalink('categories').children.map(&:name) }
end
我已经解决了重建索引页面的问题,它工作正常。
rake sunspot:reindex