Issue Bug Closed

#19254indexing of records containing HTML leads to concatenated words

Andreas Rieser 08/26/08, 16:46 updated 10/02/18, 12:29

Description

While indexing records via the class.crawler.php in the function indexSingleRecord() the content of the fields is simply passed through strip_tags() – that’s not sufficient.

In class.indexer.php in the function splitHTMLContent() it’s solved like this:

// remove tags, but first make sure we don’t concatenate words by doing it
$contentArr[‘body’] = str_replace(‘<’,’ <’,$contentArr[‘body’]);
$contentArr[‘body’] = trim(strip_tags($contentArr[‘body’]));

This has to be done here too:

$theContent = ‘’;
foreach($fieldList as $k => $v) {
if (!$k) {
$theTitle = $r[$v];
} else {
$theContent.= $r[$v].’ ‘;
}
}
        // add the following lines to prevent concatenated words
$theTitle= str_replace(‘<’,’ <’,$theTitle);
$theContent= str_replace(‘<’,’ <’,$theContent);
    // Indexing the record as a page (but with parameters set, see ->backend_setFreeIndexUid())
$indexerObj->backend_indexAsTYPO3Page(
strip_tags($theTitle),
‘’,
‘’,
strip_tags($theContent),
$GLOBALS[‘LANG’]->charSet, // Requires that
$r[$GLOBALS[‘TCA’][$cfgRec[‘table2index’]][‘ctrl’][‘tstamp’]],
$r[$GLOBALS[‘TCA’][$cfgRec[‘table2index’]][‘ctrl’][‘crdate’]],
$r[‘uid’]
);

(issue imported from #M9229)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.