/** * Handles collection filtering by ids retrieves from search engine. * Will also stores faceted data and total records. * * @return Mage_Catalog_Model_Resource_Category_Collection */ protected function _beforeLoad() { $this->_prepareQuery(); $ids = array(); $result = $this->getSearchEngineQuery()->search(); $ids = isset($result['ids']) ? $result['ids'] : array(); $this->_facetedData = isset($result['faceted_data']) ? $result['faceted_data'] : array(); $this->_totalRecords = isset($result['total_count']) ? $result['total_count'] : null; $this->_isSpellChecked = isset($result['is_spellchecked']) ? $result['is_spellchecked'] : false; if (empty($ids)) { $ids = array(0); // Fix for no result } $this->addIdFilter($ids); $this->_searchedEntityIds = $ids; $this->_pageSize = false; return parent::_beforeLoad(); }