Bug #17830
closeddoes not check sword size when type=20 (fix included)
0%
Description
If you selec type=20, it does not check for the size of the sword, so that all search index entries are found.
That's especialy a problem when you set _DEFAULT_PI_VARS.type=20, because then the indexed_search shows results even if you did not submit the search form (just by opening a page with the search plugin on)
You have to fix the problem within the following function (that's the fixed version):
------------------------
function getSearchWords($defOp) {
// Shorten search-word string to max 200 bytes (does NOT take multibyte charsets into account - but never mind, shortening the string here is only a run-away feature!)
$inSW = substr($this->piVars['sword'],0,200);
// Convert to UTF-8 + conv. entities (was also converted during indexing!)
$inSW = $GLOBALS['TSFE']->csConvObj->utf8_encode($inSW, $GLOBALS['TSFE']->metaCharset);
$inSW = $GLOBALS['TSFE']->csConvObj->entities_to_utf8($inSW,TRUE);
if ($hookObj = &$this->hookRequest('getSearchWords')) {
return $hookObj->getSearchWords_splitSWords($inSW, $defOp);
} else {
if ($this->piVars['type']==20 && strlen($inSW) > 1) {
return array(array('sword'=>trim($inSW), 'oper'=>'AND'));
} else {
$search = t3lib_div::makeInstance('tslib_search');
$search->default_operator = $defOp==1 ? 'OR' : 'AND';
$search->operator_translate_table = $this->operator_translate_table;
$search->register_and_explode_search_string($inSW);
if (is_array($search->sword_array)) {
return $this->procSearchWordsByLexer($search->sword_array);
}
}
}
}
by changing this:
if ($this->piVars['type']==20) {
return array(array('sword'=>trim($inSW), 'oper'=>'AND'));
} else {
to that:
if ($this->piVars['type']==20 && strlen($inSW) > 0) {
return array(array('sword'=>trim($inSW), 'oper'=>'AND'));
} else {
(issue imported from #M6790)
Updated by Alexander Opitz over 11 years ago
- Status changed from New to Needs Feedback
- Target version deleted (
0) - TYPO3 Version set to 4.2
The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?
Updated by Jonas Felix over 11 years ago
Alexander Opitz wrote:
The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?
We use a indexed_search xclass patch with my fix in it, that's why I simply don't know if it still exists.
Updated by Alexander Opitz over 11 years ago
- Status changed from Needs Feedback to Closed
Closed as commented.