Search code examples
typo3fluid-layoutextbasetypo3-7.6.x

TYPO3 index_search no markup result in FLUID/ExtBase


In default indexsearch extension i have highlighted keywords in search result, but when i use FLUID version it not work, I find that are different function it Controller, witch prepared description for default template and for FLUID. typo3/sysext/indexed_search/Classes/Controller/SearchController.php

452 line --- prepared for FLUID

  $resultData['description'] = $this->makeDescription(
        $row,
        (bool)!($this->searchData['extResume'] && !$headerOnly),
        $this->settings['results.']['summaryCropAfter']
    );

(bool)!($this->searchData['extResume'] && !$headerOnly) shoud give 'false' but didn't. I check ts extResume = 1 and headerOnly = false. So it seems to be wrong construction?

When replace the (bool)!($this->searchData['extResume'] && !$headerOnly) to false. I get murkups but also i needed change output format in fluid template from ---

    ...
    <f:if condition="{row.headerOnly} == 0">
        <p class="tx-indexedsearch-description">{row.description}</p> 
...

to -----

...
<f:if condition="{row.headerOnly} == 0">
    <p class="tx-indexedsearch-description"><f:format.html>{row.description}</f:format.html></p>
...

Now it work, but i still don't understand why it not work by default?


Solution

  • There is an alternative Method:

    In the Searchform define a hidden Field: (Resource/Private/Partials/Form.html)

    <f:form.hidden name="search[extResume]" value="1" />
    

    In Searchsresult.html i would use format.raw instead of format.html.

    <p class="tx-indexedsearch-description"><f:format.raw>{row.description}</f:format.raw>