Public Member Functions | |
getQueryParamName () | |
getQuery () | |
isMinQueryLength () | |
getQueryText () | |
getEscapedQueryText () | |
getSuggestCollection () | |
getResultUrl ($query=null) | |
getSuggestUrl () | |
getSearchTermUrl () | |
getAdvancedSearchUrl () | |
getMinQueryLength ($store=null) | |
getMaxQueryLength ($store=null) | |
getMaxQueryWords ($store=null) | |
addNoteMessage ($message) | |
setNoteMessages (array $messages) | |
getNoteMessages () | |
checkNotes ($store=null) | |
Public Attributes | |
const | QUERY_VAR_NAME = 'q' |
const | MAX_QUERY_LEN = 200 |
Protected Attributes | |
$_query | |
$_queryText | |
$_messages = array() | |
$_isMaxLength = false |
Definition at line 32 of file Data.php.
addNoteMessage | ( | $ | message | ) |
Add Note message
string | $message |
Definition at line 234 of file Data.php.
checkNotes | ( | $ | store = null |
) |
Check query of a warnings
mixed | $store |
Definition at line 268 of file Data.php.
00269 { 00270 if ($this->_isMaxLength) { 00271 $this->addNoteMessage($this->__('Maximum Search query length is %s. Your query was cut.', $this->getMaxQueryLength())); 00272 } 00273 00274 $stringHelper = Mage::helper('core/string'); 00275 /* @var $stringHelper Mage_Core_Helper_String */ 00276 00277 $searchType = Mage::getStoreConfig(Mage_CatalogSearch_Model_Fulltext::XML_PATH_CATALOG_SEARCH_TYPE); 00278 if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE || 00279 $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE) { 00280 00281 $wordsFull = $stringHelper->splitWords($this->getQueryText(), true); 00282 $wordsLike = $stringHelper->splitWords($this->getQueryText(), true, $this->getMaxQueryWords()); 00283 00284 if (count($wordsFull) > count($wordsLike)) { 00285 $wordsCut = array_diff($wordsFull, $wordsLike); 00286 00287 $this->addNoteMessage( 00288 $this->__('Maximum words count is %1$s. In your search query was cut next part: %2$s.', 00289 $this->getMaxQueryWords(), 00290 join(' ', $wordsCut) 00291 ) 00292 ); 00293 } 00294 } 00295 }
getAdvancedSearchUrl | ( | ) |
getEscapedQueryText | ( | ) |
Retrieve HTML escaped search query
Definition at line 137 of file Data.php.
00138 { 00139 return $this->htmlEscape($this->getQueryText()); 00140 }
getMaxQueryLength | ( | $ | store = null |
) |
Retrieve maximum query length
mixed | $store |
Definition at line 212 of file Data.php.
00213 { 00214 return Mage::getStoreConfig(Mage_CatalogSearch_Model_Query::XML_PATH_MAX_QUERY_LENGTH, $store); 00215 }
getMaxQueryWords | ( | $ | store = null |
) |
Retrieve maximum query words count for like search
mixed | $store |
Definition at line 223 of file Data.php.
00224 { 00225 return Mage::getStoreConfig(Mage_CatalogSearch_Model_Query::XML_PATH_MAX_QUERY_WORDS, $store); 00226 }
getMinQueryLength | ( | $ | store = null |
) |
Retrieve minimum query length
mixed | $store |
Definition at line 201 of file Data.php.
00202 { 00203 return Mage::getStoreConfig(Mage_CatalogSearch_Model_Query::XML_PATH_MIN_QUERY_LENGTH, $store); 00204 }
getNoteMessages | ( | ) |
getQuery | ( | ) |
Retrieve query model object
Definition at line 80 of file Data.php.
00081 { 00082 if (!$this->_query) { 00083 $this->_query = Mage::getModel('catalogsearch/query') 00084 ->loadByQuery($this->getQueryText()) 00085 ->setQueryText($this->getQueryText()); 00086 } 00087 return $this->_query; 00088 }
getQueryParamName | ( | ) |
getQueryText | ( | ) |
Retrieve search query text
Definition at line 108 of file Data.php.
00109 { 00110 if (is_null($this->_queryText)) { 00111 $this->_queryText = $this->_getRequest()->getParam($this->getQueryParamName()); 00112 if ($this->_queryText === null) { 00113 $this->_queryText = ''; 00114 } else { 00115 if (is_array($this->_queryText)) { 00116 $this->_queryText = null; 00117 } 00118 $this->_queryText = trim($this->_queryText); 00119 if (Mage::helper('core/string')->strlen($this->_queryText) > $this->getMaxQueryLength()) { 00120 $this->_queryText = Mage::helper('core/string')->substr( 00121 $this->_queryText, 00122 0, 00123 $this->getMaxQueryLength() 00124 ); 00125 $this->_isMaxLength = true; 00126 } 00127 } 00128 } 00129 return $this->_queryText; 00130 }
getResultUrl | ( | $ | query = null |
) |
getSearchTermUrl | ( | ) |
getSuggestCollection | ( | ) |
getSuggestUrl | ( | ) |
isMinQueryLength | ( | ) |
Is a minimum query length
Definition at line 95 of file Data.php.
00096 { 00097 if (Mage::helper('core/string')->strlen($this->getQueryText()) < $this->getMinQueryLength()) { 00098 return true; 00099 } 00100 return false; 00101 }
setNoteMessages | ( | array $ | messages | ) |
Set Note messages
array | $messages |
Definition at line 246 of file Data.php.
const MAX_QUERY_LEN = 200 |
const QUERY_VAR_NAME = 'q' |