cancel
Showing results for 
Search instead for 
Did you mean: 

Magento CE 1.9.3.1 Seach is totally dead returning no result?

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Magento CE 1.9.3.1 Seach is totally dead returning no result?

diff --git a/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext/Collection.php b/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext/Collection.php
index bb364f2..0c6132f 100644
--- a/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext/Collection.php
+++ b/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext/Collection.php
@@ -127,7 +127,7 @@ class Mage_CatalogSearch_Model_Resource_Fulltext_Collection extends Mage_Catalog
         if (!empty($foundIds)) {
             $this->addIdFilter($foundIds);
         } else {
-            $this->getSelect()->orWhere('FALSE');
+            $this->getSelect()->where('FALSE');
         }
         $this->_isSearchFiltersApplied = true;
// A quick $this->getSelect() in function _applySearchFilters shows below sql:   AND (FALSE) condition will never meet in any case, I think? 

SELECT `e`.*,
       FIND_IN_SET(e.entity_id, '836,829,840,839,837,838,832,833,835,834,830,831,1887') AS `relevance`,
       `price_index`.`price`,
       `price_index`.`tax_class_id`,
       `price_index`.`final_price`,
       IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`,
       `price_index`.`min_price`,
       `price_index`.`max_price`,
       `price_index`.`tier_price`,
       `cat_index`.`position` AS `cat_index_position`
FROM `catalog_product_entity` AS `e`
INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id
AND price_index.website_id = '1'
AND price_index.customer_group_id = 0
INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id
AND cat_index.store_id='1'
AND cat_index.visibility IN(3, 4)
AND cat_index.category_id = '2'
WHERE (e.entity_id IN (836,
                       829,
                       840,
                       839,
                       837,
                       838,
                       832,
                       833,
                       835,
                       834,
                       830,
                       831,
                       1887))
  AND (FALSE)
9 REPLIES 9

Re: Magento CE 1.9.3.1 Seach is totally dead returning no result?

 Hello,

 

I have the same issue

 

2016-11-17T12:41:36+00:00 EMERG (): SELECT `e`.*, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `cat_index`.`position` AS `cat_index_position` FROM `catalog_product_entity` AS `e`
 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
 INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id='1' AND cat_index.visibility IN(3, 4) AND cat_index.category_id = '2'
2016-11-17T12:41:36+00:00 EMERG (): Array
(
    [class] => Mage_CatalogSearch_Model
    [resourceModel] => catalogsearch_resource
)

Re: Magento CE 1.9.3.1 Seach is totally dead returning no result?

Hi!

 

I've goy pretty clean Magento that was a 1.9.2.4 and now is a 1.9.3.1.

Is the environment that I use to build M1 modules and I have a small catalog (10 products).

 

I've made a simple search and then I've filtered the result by category and has worked.

Can you explain the steps to try to reproduce the problem?

Re: Magento CE 1.9.3.1 Seach is totally dead returning no result?

Are you using any extensions related to search? We were using the Better Store Search extension, I was having the same problem.  Once I removed the extension our store search started working again.

Re: Magento CE 1.9.3.1 Seach is totally dead returning no result?

I found the issue causes already. The query was being forced to be AND (FALSE) in the where conditions. There will force mysql to return empty. 

Re: Magento CE 1.9.3.1 Seach is totally dead returning no result?

I'm having the same issue after upgrading to 1.9.3.1

 

what do I change to prevent the query to be forced to AND (FALSE) ?

 

I already have the following:

 

    protected function _applySearchFilters()
    {
        $foundIds = $this->getFoundIds();
        if (!empty($foundIds)) {
            $this->addIdFilter($foundIds);
        } else {
            $this->getSelect()->where('FALSE');
        }
        $this->_isSearchFiltersApplied = true;

        return $this;
    }

Re: Magento CE 1.9.3.1 Seach is totally dead returning no result?

Hi @ErickFb23,

 

Is your store online? Can you sahre the url?

Also, can you share screenshot of your catalog search configuration?

Re: Magento CE 1.9.3.1 Seach is totally dead returning no result?

Hello All,

I have the same issue, my search is not working after the upgrade, even if I roll-back the code is not working, I assume because of the attribute modification in the Database.

Is there any solution?

Regards,

Re: Magento CE 1.9.3.1 Seach is totally dead returning no result?

Yep.

 

Change below 

 

    protected function _applySearchFilters()
    {
        $foundIds = $this->getFoundIds();
        if (!empty($foundIds)) {
            $this->addIdFilter($foundIds);
        } else {
            $this->getSelect()->where('FALSE');
        }
        $this->_isSearchFiltersApplied = true;

        return $this;
    }

 

To

 

    protected function _applySearchFilters()
    {
        $foundIds = $this->getFoundIds();
        if (!empty($foundIds)) {
            $this->addIdFilter($foundIds);
        } else {
            $this->getSelect()->orWhere('FALSE');
        }
        $this->_isSearchFiltersApplied = true;

        return $this;
    }

 

Re: Magento CE 1.9.3.1 Seach is totally dead returning no result?

Hello,

 

the above might be a workaround.

 

However for anyone using Better Store Search - we just released an update (version 3.5.1.1) for it that deals with the incompatibility.

Everyone with a current update key can get it at http://www.betterstorecms.com/selfserve/#license-search-section