我有企业 magento 1.10,我需要将自定义字段添加到 solr 索引以获得更好的搜索结果。此自定义字段应包含索引产品的类别名称。
我需要知道我需要修改magento的哪一部分。我修改了 Enterprise_Search_Model_Resource_Index::_getCatalogCategoryData 方法,它实际上产生了一些与类别相关的数据,但我的新字段没有出现在发送给 sorl 的消息中。
我错过了什么吗?
我这里也有一些注释,也许有人会帮助http://docs.nostresscommerce.com:8090/pages/viewpage.action?pageId=2490371
我重写了 Enterprise_Search_Model_Resource_Index::_getCatalogCategoryData 的输出,我需要 solr 中的 category_name_level_*。
[result] => Array
(
[12227] => Array
(
[#categories] => Array
(
[0] => 2
[3] => 3235
[7] => 2765
[10] => 6672
)
[#show_in_categories] => Array
(
[1] => 6671
[2] => 6670
[4] => 3224
[5] => 3199
[6] => 3191
[8] => 2761
[9] => 2760
)
[#position_category_2] => 1
[#position_category_6671] => 120000
[#position_category_6670] => 120000
[#position_category_3235] => 0
[#position_category_3224] => 150000
[#position_category_3199] => 150000
[#position_category_3191] => 120000
[#position_category_2765] => 1
[#position_category_2761] => 250001
[#position_category_2760] => 250001
[#position_category_6672] => 0
[#visibility] => 4
[#category_name_level_1] => Array
(
[0] => BCC Root Category
)
[#category_name_level_4] => Array
(
[0] => Huishouden
[1] => Top wasmachines
[2] => Accessoires wasmachine
)
[#category_name_level_3] => Array
(
[0] => Beste Koop Shop
[1] => Top
[2] => Wasmachine
)
[#category_name_level_2] => Array
(
[0] => Acties
[1] => Speciale informatie pagina's
[2] => Huishouden
)
[#category_name_level_5] => Array
(
[0] => Wasmachines
)
)
)
非常感谢,杰罗。
我找到了解决方案
class Xyz_Solrsearch_Model_Resource_Engine extends Enterprise_Search_Model_Resource_Engine {
public function __construct()
{
$this->_advancedDynamicIndexFields[] = '#category_name_level_';
parent::__construct();
}
}