[BUGFIX] Remove whitespaces in the indexed search body description 75/41375/2
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Wed, 15 Jul 2015 21:11:55 +0000 (23:11 +0200)
committerBenjamin Mack <benni@typo3.org>
Thu, 16 Jul 2015 08:48:53 +0000 (10:48 +0200)
The indexed search body description has a character length limit,
so it's important to remove unnecessary white spaces, so more text
will fit.

Resolves: #46298
Releases: master
Change-Id: Icc7a5833b2d6d22e631e8e376a00df9d3a838511
Reviewed-on: http://review.typo3.org/41375
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/indexed_search/Classes/Indexer.php

index bb72fe3..39ef7c4 100644 (file)
@@ -1280,7 +1280,7 @@ class Indexer {
                // Setting description
                $maxL = MathUtility::forceIntegerInRange($this->conf['index_descrLgd'], 0, 255, 200);
                if ($maxL) {
-                       $bodyDescription = str_replace(array(' ', TAB, CR, LF), ' ', $contentArr['body']);
+                       $bodyDescription = preg_replace('/\s+/u', ' ', $contentArr['body']);
                        // Shorten the string:
                        $bodyDescription = $this->csObj->strtrunc('utf-8', $bodyDescription, $maxL);
                }