[TYPO3-dev] Indexed Search - Search results data

Ulrik Høyer Kold uhk at netimage.dk
Thu Nov 15 09:54:52 CET 2012


Den 29-10-2012 15:45, Tomas Norre Mikkelsen skrev:
> Hi,
>
> I have indexed search configured, or at least almost still som issue i
> want to change.
>
> When searching for eg. Berlin, my Search result looks like this:
>
> Berlin
> Berlin Berlin Vidunderlige Berlin emmer af historie og oplevelser fra
> A-Z Berlin er blevet ét af de mest attraktive rejsemål i Europa. ...
> herretur, kæresteferie eller familieferie, så vil Berlin kunne tilbyde
> dig meget - og rejsen varer kun omkring ... bl.a. museer om krigen og
> efterkrigstiden, f.eks.
>
> The "Berlin" text is there 3 times before starting the body-text, i
> guess it's the page title shown here.
>
> When adding meta-description or meta-keywords they are shown after the 3
> "berlin" texts.. Is it posible to manipulate with the data shown, right
> now the template contains following:
>
> <!-- ###ROW_LONG### begin -->
>         <tr>
>           <!-- td>&nbsp;</td -->
>
>           <td class="tx-indexedsearch-descr descr" width="100%"
> colspan="3">###DESCRIPTION###</td>
>         </tr>
> <!-- ###ROW_LONG### end -->
>
> Which doesn't give me much possibilities to change cause only one marker.
>
> How to change whats shown in the result? Cannot find any info in the man
> page, either for indexed_search or for the crawler indexing the page.
>
> Hints are very welcome =)
>
>
Here is a hint: In class.tx_indexedsearch.php there is a hook to post 
process the search results: prepareResultRowTemplateData_postProc

We added a line of config into localconf.php to include a custom hook:

$TYPO3_CONF_VARS['EXTCONF']['indexed_search']['pi1_hooks']['prepareResultRowTemplateData_postProc'] 
= 
'fileadmin/hooks/ext/indexed_search/class.pihook.php:&tx_indexedsearch_pihook';

This hook the reprocessed the description for the search result item and 
stripped away the page title, page description, and page keywords from 
the beginning of the fulltextdata before returning the remaining string.

The code for the hook is available from Pastebin: 
http://pastebin.com/qCXsKzk0

Feel free to use it and modify it.

Sincerely,
Ulrik H. Kold,
uhk at netimage.dk - kontakt at ulrikkold.dk



More information about the TYPO3-dev mailing list