protected function _getMatchedIds($query) { if (!is_array($this->_attributes) || !count($this->_attributes)) { Mage::throwException('Searchable attributes not defined'); } $query = Mage::helper('core/string')->splitWords($query, true, 100); $select = $this->_collection->getSelect(); $having = array(); foreach ($query as $word) { $subhaving = array(); foreach ($this->_attributes as $attr => $weight) { $subhaving[] = $this->_getCILike($attr, $word, array('position' => 'any')); } $having[] = '(' . implode(' OR ', $subhaving) . ')'; } $havingCondition = implode(' AND ', $having); if ($havingCondition != '') { $select->having($havingCondition); } $read = Mage::getSingleton('core/resource')->getConnection('core_read'); $stmt = $read->query($select); $result = array(); while ($row = $stmt->fetch(Zend_Db::FETCH_ASSOC)) { $result[$row[$this->_primaryKey]] = 0; } return $result; }