Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

solr

magento

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

like image 822
Sajid Hussain Avatar asked Jul 26 '12 10:07

Sajid Hussain


1 Answers

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)); }

like image 51
runamok Avatar answered Nov 15 '22 05:11

runamok