Bug #36953
Search results break over ascii-tab code in content
| Status: | Closed | Start date: | 2012-05-08 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - | |||
| Votes: | 0 |
Description
The search results plugin shows nothing at all when it tries to display results containing chr(11) (ascii-tab). You may argue whether these codes should be there at all (probably inserted by some editor using cut and paste from another site or program), but since TYPO3 doesn't remove them ke_search shouldn't fail when they occur.
I found them in title and content fields of news records.
I resolved the issue by filtering in the indexer, class.tx_kesearch_indexer.php starting from line 394:
public function prepareRecordForInsert($fieldValues) {
$addQueryPartFor = $this->getQueryPartForAdditionalFields($fieldValues);
$removeCharacters = array(chr(11));
$queryArray = array();
$queryArray['set'] = 'SET
@pid = ' . $fieldValues['pid'] . ',
@title = ' . str_replace($removeCharacters, '', $fieldValues['title']) . ',
@type = ' . $fieldValues['type'] . ',
@targetpid = ' . $fieldValues['targetpid'] . ',
@content = ' . str_replace($removeCharacters, '', $fieldValues['content']) . ',
@tags = ' . $fieldValues['tags'] . ',
@params = ' . $fieldValues['params'] . ',
@abstract = ' . str_replace($removeCharacters, '', $fieldValues['abstract']) . ',
@language = ' . $fieldValues['language'] . ',
@starttime = ' . $fieldValues['starttime'] . ',
@endtime = ' . $fieldValues['endtime'] . ',
@fe_group = ' . $fieldValues['fe_group'] . ',
@tstamp = ' . $fieldValues['tstamp'] . ',
@crdate = ' . $fieldValues['crdate'] . $addQueryPartFor['set'] . '
;';
Probably the issue could also be solved in the output rendering part but I didn't look into that.
History
Updated by Christian Buelter about 1 year ago
- Status changed from New to Needs Feedback
Loek,
I guess, this is a duplicate of http://forge.typo3.org/issues/34808, what do you think?
Updated by Loek Hilgersom about 1 year ago
That's correct, I did not find it because of the wrong title in the issue, but that's corrected now (it's not really about showing an error message, the important part is making sure the output doesn't break).
The proposed patch http://forge.typo3.org/attachments/20882/Patch_34808.patch also looks better:- after thinking about it I agree that you can safely remove all control characters (you don't want things like newlines in the results)
- the function createFieldValuesForIndexing also seems the better place to do the filtering if that also takes care of the updates (and not just inserts).
Updated by Christian Buelter about 1 year ago
- Status changed from Needs Feedback to Closed
OK, then I close this issue as a duplicate of http://forge.typo3.org/issues/34808.
We will review that patch and add it to ke_search if it works.