
Public Member Functions | |
| getResultCollection () | |
| getSuggestCollection () | |
| loadByQuery ($text) | |
| setStoreId ($storeId) | |
| getStoreId () | |
| prepare () | |
| getMinQueryLenght () | |
| getMaxQueryLenght () | |
| getMaxQueryWords () | |
Public Attributes | |
| const | CACHE_TAG = 'SEARCH_QUERY' |
| const | XML_PATH_MIN_QUERY_LENGTH = 'catalog/search/min_query_length' |
| const | XML_PATH_MAX_QUERY_LENGTH = 'catalog/search/max_query_length' |
| const | XML_PATH_MAX_QUERY_WORDS = 'catalog/search/max_query_words' |
Protected Member Functions | |
| _construct () | |
Definition at line 32 of file Query.php.
| _construct | ( | ) | [protected] |
Init resource model
Reimplemented from Varien_Object.
Definition at line 43 of file Query.php.
00044 { 00045 $this->_init('catalogsearch/query'); 00046 }
| getMaxQueryLenght | ( | ) |
Retrieve maximum query length
Definition at line 160 of file Query.php.
00161 { 00162 return Mage::getStoreConfig(self::XML_PATH_MAX_QUERY_LENGTH, $this->getStoreId()); 00163 }
| getMaxQueryWords | ( | ) |
Retrieve maximum query words for like search
Definition at line 170 of file Query.php.
00171 { 00172 return Mage::getStoreConfig(self::XML_PATH_MAX_QUERY_WORDS, $this->getStoreId()); 00173 }
| getMinQueryLenght | ( | ) |
Retrieve minimum query length
Definition at line 150 of file Query.php.
00151 { 00152 return Mage::getStoreConfig(self::XML_PATH_MIN_QUERY_LENGTH, $this->getStoreId()); 00153 }
| getResultCollection | ( | ) |
Retrieve collection of search results
Definition at line 53 of file Query.php.
00054 { 00055 $collection = $this->getData('result_collection'); 00056 if (is_null($collection)) { 00057 $collection = Mage::getResourceModel('catalogsearch/search_collection'); 00058 00059 $text = $this->getSynonimFor(); 00060 if (!$text) { 00061 $text = $this->getQueryText(); 00062 } 00063 00064 $collection->addSearchFilter($text) 00065 ->addStoreFilter() 00066 ->addMinimalPrice() 00067 ->addTaxPercents(); 00068 $this->setData('result_collection', $collection); 00069 } 00070 return $collection; 00071 }
| getStoreId | ( | ) |
| getSuggestCollection | ( | ) |
Retrieve collection of suggest queries
Definition at line 78 of file Query.php.
00079 { 00080 $collection = $this->getData('suggest_collection'); 00081 if (is_null($collection)) { 00082 $collection = Mage::getResourceModel('catalogsearch/query_collection') 00083 ->setStoreId($this->getStoreId()) 00084 ->setQueryFilter($this->getQueryText()); 00085 $this->setData('suggest_collection', $collection); 00086 } 00087 return $collection; 00088 }
| loadByQuery | ( | $ | text | ) |
Load Query object by query string
| string | $text |
Definition at line 96 of file Query.php.
00097 { 00098 $this->_getResource()->loadByQuery($this, $text); 00099 $this->_afterLoad(); 00100 $this->setOrigData(); 00101 return $this; 00102 }
| prepare | ( | ) |
Prepare save query for result
Definition at line 133 of file Query.php.
00134 { 00135 if (!$this->getId()) { 00136 $this->setIsActive(0); 00137 $this->setIsProcessed(0); 00138 $this->save(); 00139 $this->setIsActive(1); 00140 } 00141 00142 return $this; 00143 }
| setStoreId | ( | $ | storeId | ) |
Set Store Id
| int | $storeId |
Definition at line 110 of file Query.php.
00111 { 00112 $this->setData('store_id', $storeId); 00113 }
| const XML_PATH_MAX_QUERY_LENGTH = 'catalog/search/max_query_length' |
| const XML_PATH_MAX_QUERY_WORDS = 'catalog/search/max_query_words' |
| const XML_PATH_MIN_QUERY_LENGTH = 'catalog/search/min_query_length' |
1.5.8