Issue 0:

Plain old catalog search returns no results; I've exhausted all the hints online, caching and attributes, etc, looked at MANY postings here and on Google. (vanilla install of CE 1.8 with custom data submitted via REST; but even items with no category are allowed to be displayed)

So I finally started putting Mage::log() statements everywhere to track it down.

Issue 1:

I noticed the query logic checks for !getIsProcessed(), and skips the search if it's already been done, which seems reasonable.

But the problem is that "is_processed" => 1 is in every place I check the query object, and I can't figure out why.

So this seems to be the primary problem: is_processed is always 1. (I realize it's referenced multiple times as a page is rendered, it's set to 1 even on the first time, and YES caching is off)

Issue 2:

I had an idea to print a stack trace from setIsProcessed, whenever the value is set to 1, so I could find the culprit.

But I don't see where setIsProcessed is defined? I followed back through the classes, Query -> Abstract -> Varien Object, etc. and don't see where it's defined. It's mentioned in the comments, and certainly called.

My other idea was to just override it in Query but I never see this message in the logs. (I didn't bother adding the if 1 and stack logic since it's not called at all)

    public function setIsProcessed( $i ) {
            Mage::log( "*** QUERY setIsProcessed called ***" );
            parent::setIsProcessed( $i );

Thanks (and yes, I'm somewhat new to PHP and Magento)

| improve this question | | | | |
  • 2
    setIsProcessed($flag) is actually an alias for setData('is_processed', $flag). Magento uses the magic function __call to call methods that don't actually exist. ro1.php.net/manual/en/language.oop5.overloading.php#object.call I hope that helps a little. – Marius Jan 9 '14 at 7:49
  • @Marius thanks! It's at least a hint, and something new to explore. – Mark Bennett Jan 9 '14 at 7:57
  • @Marius first I tried overriding __call in CatalogSearch/Model/Query.php and later base Mage/Core/Model/Abstract.php to log, and still calling return parent::__call( $method, $args ); But seemed to not find setIsProcessed. So finally went to lib/Varien/Object.php and added this to the top of __call: if ( $method == "setIsProcessed" ) { Mage::log( "**** Varien OBJECT __call called: method='" . $method . "', args='" . $args . "'" ); } BUT I still don't see setIsProcessed being called. So the question remains: who the heck is calling setIsProcessed(1) ? – Mark Bennett Jan 9 '14 at 9:41
  • Doing a quick search through the code I found that the method is called in Mage_Adminhtml_Catalog_SearchController::saveAction, Mage_CatalogSearch_ResultController::indexAction, Mage_CatalogSearch_Model_Query::prepare and Mage_CatalogSearch_Model_Resource_Fulltext::prepareResult and Mage_XmlConnect_CatalogController::searchAction. – Marius Jan 9 '14 at 9:50
  • @Marius Yup, I found all those. But you'll notice most of the time they're setting them to 0. To be safe I'll recheck the 2 places they set it to 1. – Mark Bennett Jan 9 '14 at 10:25