Project

General

Profile

Actions

Bug #46298

closed

Epic #65815: Improve Indexed search indexer

Whitespace problem

Added by Tobi no-lastname-given almost 12 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Indexed Search
Target version:
Start date:
2013-03-14
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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


Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Bug #46297: Description LengthClosed2013-03-14

Actions
Actions

Also available in: Atom PDF