数据文件夹中的所有索引文件都归root所有,SOLR jar以root身份运行。我设置了所有日志为warning,但当前没有任何日志被记录。我管理其他使用Solr的网站,从未遇到过这个问题 - 然而,在此安装中有很多属性(330个)和许多产品(~100,000)。这可能是问题的一部分吗?谢谢!
由于Enterprise_Search模块默认每天在凌晨3点运行一次cronjob,因此我找到了比将一行代码添加到shell/abstract.php
文件中更好的解决方案。
你只需要创建一个小模块,将某个事件添加到全局命名空间而不是管理命名空间即可:
<?xml version="1.0"?>
<config>
<modules>
<YourNamespace_YourModuleName>
<version>0.0.1</version>
</YourNamespace_YourModuleName>
</modules>
<global>
<events>
<!-- The misspelling (cat-e-logsearch) is correct, you can look it up in the config.xml of the Enterprise_Search module -->
<catelogsearch_searchable_attributes_load_after>
<observers>
<enterprise_search>
<class>enterprise_search/observer</class>
<method>storeSearchableAttributes</method>
</enterprise_search>
</observers>
</catelogsearch_searchable_attributes_load_after>
</events>
</global>
</config>
不要忘记在app/etc/modules/YourNamespace_YourModuleName.xml
路径下放置另一个配置文件来激活你的模块:
<?xml version="1.0"?>
<config>
<modules>
<YourNamespace_YourModuleName>
<active>true</active>
<codePool>local</codePool>
<depends>
<Enterprise_Search/>
</depends>
</YourNamespace_YourModuleName>
</modules>
</config>
php shell/indexer.php --reindex catalogsearch_fulltext
EE1.12也可能不是解决方案。我们有一个在EE1.12上的客户,他们在SOLR集成方面遇到了问题。在他们的情况下,当索引器访问自定义产品属性时,所有索引尝试都会失败。
Nexcess和Magento支持团队已经在此工作了6周以上,目前Magento支持团队的状态是 -
不幸的是,补丁仍在开发中,我无法告知我们的开发人员何时完成。
在搜索了几天的解决方案后(顺便遇到了这个问题),我认为我有一个解决方案。我进行了测试,没有发现任何错误。
# shell/abstract.php @ line 75
public function __construct()
{
if ($this->_includeMage) {
require_once $this->_getRootPath() . 'app' . DIRECTORY_SEPARATOR . 'Mage.php';
Mage::app($this->_appCode, $this->_appType);
Mage::app()->addEventArea('adminhtml');# the magic line
}
$this->_applyPhpVariables();
$this->_parseArgs();
$this->_construct();
$this->_validate();
$this->_showHelp();
}
enterprise_search/observer
没有加载,因此无法触发storeSearchableAttributes
方法。这导致各种额外数据无法注册。你有花时间查看索引器运行时的solr日志吗?我们目前正在运行1.12版本,即使在那里也发现了几个solr问题。当solr通知我们有一个bug时,我们不得不进行故障排除。
我的评论在这里回答中:Magento 1.12和Solr 3.6没有正确的结果和拼写建议
我认为这个建议适用于1.11版本,但你可能需要稍微修改一下。 打开./app/code/core/Enterprise/Search/Model/Adapter/Abstract.php 并找到prepareDocsPerStore。
您可以监视和记录发送到solr的文档作为健全性检查。因此,您可以在$docs[] = $doc;下面快速而肮脏地执行以下操作:
$solr_log_file = '/mnt/tmp/'.date('Y-m-d',time()).'/'.$storeId.'-'.$productId.'-solr.txt'; file_put_contents($solr_log_file, var_export($doc, true)); 警告:我可能会有一些语法错误,因为我刚刚草草地写出来了。
在这行代码之前和之后执行 $productIndexData 的 var_export 也很有启发性: $productIndexData = $this->_prepareIndexProductData($productIndexData, $productId, $storeId);
嗨,我已经找到了另一个解决方案来解决这个问题,在我的情况下,我编写了一个带有以下代码的小脚本
ini_set("memory_limit","1000M");
require_once "app/Mage.php";
umask(0);
Mage::app();
$observer = Mage::getModel('enterprise_search/observer');
$observer->storeSearchableAttributes();
使用名称为solrindex.php的文件,在浏览器中运行,例如mydomain/solrindex.php,然后从管理面板重新索引catalogsearch,这对我有效。