Project

General

Profile

Actions

Bug #46718

closed

Description Length

Added by Georg Ringer over 11 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:
6.0
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The Search Result Description is really short. So I found the bug in the code. In SearchController around Line 580:

/**
     * Returns the resume for the search-result.
     *
     * @param array $row Search result row
     * @param boolean $noMarkup If noMarkup is FALSE, then the index_fulltext table is used to select the content of the page, split it with regex to display the search words in the text.
     * @param integer $length String length
     * @return string HTML string
     * @todo overwork this
     */
    protected function makeDescription($row, $noMarkup = FALSE, *$length = 180*) {
        if ($row['show_resume']) {
            if (!$noMarkup) {
                $markedSW = '';
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'index_fulltext', 'phash=' . intval($row['phash']));
                if ($ftdrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                    // Cut HTTP references after some length
                    $content = preg_replace('/(http:\\/\\/[^ ]{60})([^ ]+)/i', '$1...', $ftdrow['fulltextdata']);
                    $markedSW = $this->markupSWpartsOfString($content);
                }
                $GLOBALS['TYPO3_DB']->sql_free_result($res);
            }
            if (!trim($markedSW)) {
                $outputStr = $GLOBALS['TSFE']->csConvObj->crop('utf-8', $row['item_description'], $length);
                $outputStr = htmlspecialchars($outputStr);
            }
            $output = $outputStr ? $outputStr : $markedSW;
            $output = $GLOBALS['TSFE']->csConv($output, 'utf-8');
        } else {
            $output = '<span class="noResume">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.noResume', 'indexed_search') . '</span>';
        }
        return $output;
    }

The variable name should be $length not $lgd.

Actions

Also available in: Atom PDF