Issue Bug Closed

#46298Whitespace problem

Tobi no-lastname-given 03/14/13, 21:17 updated 10/19/17, 21:59

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

Reviews 1