Magento 1.12 and Solr 3.6 No proper results and no spell suggestions

最后都变了- 提交于 2020-01-13 03:29:08

问题


Any idea or suggestion. I am kind of confuse , I have setup solr and magento couple of times but now with magento 1.12 its behaving strange no proper results and no spell check.

We had our magento 1.11 working fine with solr 1.4 ,its still working fine I try to use 1.4 and solr 3.6 no fix.

Any idea or suggestion. I am kind of confuse


回答1:


We have found multiple problems with solr with Magento EE 1.12.

  1. If you run the fulltext indexer from the shell via a cronjob the following event (yes it is spelled incorrectly) "catelogsearch_searchable_attributes_load_after" will not be dispatched and this method will not be run: storeSearchableAttributes. This prevented all the fulltext attributes from being sent in the Solr Documents. The solution is to run it from the GUI BUT you must extend your php timeout in .htaccess and probably extend php memory limit as well. I will probably hardcode it somewhere because you obviously don't want such a long timeout for your website visitors.

  2. I recommend enabling "partial commit" in the magento admin gui.

  3. Pay attention to the solr log when you are running this indexer. It gives valuable clues. We had two issues which were causing severe errors in solr. One where a "*" was being escaped to "\*" incorrectly. We overrode it by creating a local override from core where we check !== "*": app/code/local/Enterprise/Search/Model/Adapter/Solr/Abstract.php

                 foreach ($facetFieldConditions as $facetCondition) {
                     if (is_array($facetCondition) && isset($facetCondition['from'])
                             && isset($facetCondition['to'])) {
                        $from = (isset($facetCondition['from']) && strlen(trim($facetCondition['from'])) && trim($facetCondition['from']) !== "*")
                             ? $this->_prepareQueryText($facetCondition['from'])
                             : '*';
                        $to = (isset($facetCondition['to']) && strlen(trim($facetCondition['to'])) && trim($facetCondition['to']) !== "*")
    
  4. We also had a case where an attribute that was set to multiselect could have no options chosen. Long story short when the array was empty it resulted in an empty string being appended which threw an error. The solution was to first check if the array was empty. So we had to override with app/code/local/Enterprise/Search/Model/Adapter/Abstract.php

    if (!empty($val)) { $preparedValue = array_merge($preparedValue, explode(',', $val)); }




回答2:


We also just fixed a problem where product with select/multi-select attributes were being sent with blank labels to solr. This caused the indexer to fail to complete.

We overrode app/code/core/Enterprise/Search/Model/Adapter/Abstract.php and will make a local module to override this correctly.

Here's the fix

--- a/app/code/core/Enterprise/Search/Model/Adapter/Abstract.php
+++ b/app/code/local/Enterprise/Search/Model/Adapter/Abstract.php
@@ -434,6 +434,10 @@ abstract class Enterprise_Search_Model_Adapter_Abstract
                     foreach ($preparedValue as $id => $val) {
                         $preparedValue[$id] = $attribute->getSource()->getOptionText($val);
                     }
+                    
+                    $preparedValue = array_filter($preparedValue);
+                    $preparedNavValue = array_filter($preparedNavValue);
+                    
                 } else {
                     $preparedValue = $value;
                     if ($backendType == 'datetime') {


来源:https://stackoverflow.com/questions/11667728/magento-1-12-and-solr-3-6-no-proper-results-and-no-spell-suggestions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!