Bug #46298
closedEpic #65815: Improve Indexed search indexer
Whitespace problem
100%
Description
There is another bug. The indexer writes to the db table index_phash in field item_description. But there are to many whitespaces in the string. So you get just a view words. In the Indexer.php around line 1309 you have to change the following:
/** * Extracts the sample description text from the content array. * * @param array Content array * @return string Description string * @todo Define visibility */ public function bodyDescription($contentArr) { // Setting description $maxL = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->conf['index_descrLgd'], 0, 255, 200); if ($maxL) { // Shorten the string: //$bodyDescription = str_replace(array(TAB, CR, LF,' '), ' ', $contentArr['body']); $bodyDescription = preg_replace('/\s+/', ' ', $contentArr['body']); $bodyDescription = $this->csObj->strtrunc('utf-8', $bodyDescription, $maxL); } return $bodyDescription; } Use preg_replace preg_replace('/\s+/' ... this removes all whitespaces and replaces width one whitespace
Updated by Tobi no-lastname-given over 11 years ago
There is another bug. The indexer writes to the db table index_phash in field item_description. But there are to many whitespaces in the string. So you get just a view words. In the Indexer.php around line 1309 you have to change the following:
/** * Extracts the sample description text from the content array. * * @param array Content array * @return string Description string * @todo Define visibility */ public function bodyDescription($contentArr) { // Setting description $maxL = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->conf['index_descrLgd'], 0, 255, 200); if ($maxL) { // Shorten the string: //$bodyDescription = str_replace(array(TAB, CR, LF,' '), ' ', $contentArr['body']); $bodyDescription = preg_replace('/\s+/', ' ', $contentArr['body']); $bodyDescription = $this->csObj->strtrunc('utf-8', $bodyDescription, $maxL); } return $bodyDescription; }
Use preg_replace preg_replace('/\s+/' ... this removes all whitespaces and replaces width one whitespace
Updated by Alexander Opitz over 11 years ago
Hi Tobi,
can you make patches and add them to gerrit please?
Updated by Georg Ringer over 11 years ago
- Subject changed from Description Length to Whitespace problem
Updated by Oliver Hader over 11 years ago
- Target version changed from 6.1.0-beta1 to 2222
Updated by Oliver Hader over 11 years ago
- Project changed from 1382 to TYPO3 Core
Updated by Mathias Schreiber almost 10 years ago
- Target version set to 7.5
- TYPO3 Version set to 4.5
- Is Regression set to No
Updated by Gerrit Code Review over 9 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/41375
Updated by Tymoteusz Motylewski over 9 years ago
- Status changed from Under Review to Resolved
- % Done changed from 10 to 100
Applied in changeset 7eb1944658c7bdc32b98f62dff3c63266105781f.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed