/** * Retrieve query model object * * @return Mage_CatalogSearch_Model_Query */ public function getQuery() { if (!$this->_query) { $this->_query = Mage::getModel('catalogsearch/query')->loadByQuery($this->getQueryText()); if (!$this->_query->getId()) { $this->_query->setQueryText($this->getQueryText()); } } return $this->_query; }