Project

General

Profile

Actions

Bug #46298

closed

Epic #65815: Improve Indexed search indexer

Whitespace problem

Added by Tobi no-lastname-given about 11 years ago. Updated over 6 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 #1

Updated by Tobi no-lastname-given about 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

Actions #2

Updated by Alexander Opitz about 11 years ago

Hi Tobi,

can you make patches and add them to gerrit please?

Actions #3

Updated by Georg Ringer about 11 years ago

  • Subject changed from Description Length to Whitespace problem
Actions #4

Updated by Oliver Hader about 11 years ago

  • Target version changed from 6.1.0-beta1 to 2222
Actions #5

Updated by Oliver Hader about 11 years ago

  • Project changed from 1382 to TYPO3 Core
Actions #6

Updated by Oliver Hader about 11 years ago

  • Category set to Indexed Search
Actions #7

Updated by Oliver Hader about 11 years ago

  • Target version deleted (2222)
Actions #8

Updated by Mathias Schreiber about 9 years ago

  • Target version set to 7.5
  • TYPO3 Version set to 4.5
  • Is Regression set to No
Actions #9

Updated by Tymoteusz Motylewski about 9 years ago

  • Parent task set to #65815
Actions #10

Updated by Gerrit Code Review over 8 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

Actions #11

Updated by Tymoteusz Motylewski over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 10 to 100
Actions #12

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF