DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Administrator manual

Hooks

  • extension registers a hook for own post-process in fe outputting
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['isOutputting']['tx_cpssearchhighlight'] = 'CPSIT\\CpsSearchhighlight\\Hooks\\SearchhighlightProcess->main';
  • extension registers a hook for solr result modifier, if solr extension is installed in system
$TYPO3_CONF_VARS['EXTCONF']['solr']['modifyResultDocument']['searchWords'] = 'CPSIT\\CpsSearchhighlight\\Solr\\ResultsModifier\\SearchWords';

Target group: Administrators

Installation

  • Download extension from TER and install
  • Include static template from extension to your TypoScript template

Configuration

All configuration options are available in TypoScript

plugin.tx_cpssearchhighlight

_CSS_DEFAULT_STYLE

Property

_CSS_DEFAULT_STYLE

Data type

string

Description

CSS included in the page for highlight formating

Default

.tx-cpssearchhighlight-sword { background-color: yellow; }
.tx-cpssearchhighlight-sword-1 { background-color: yellow; }
.tx-cpssearchhighlight-sword-2 { background-color: aqua; }
.tx-cpssearchhighlight-sword-3 { background-color: lime;}

sword_array

Property

sword_array

Data type

COA

Description

In this configuration part you can add additional possible url params for analyse from url and highlighting. You can use full TypoScript functionality

Example

sword_array = COA
sword_array {
        10 = TEXT
        10 {
                data = GP:tx_ttnews|swords
                split {
                        token.char = 32
                        cObjNum = 1
                        1.current = 1
                        1.wrap = |,
                        wrap = |
                }
        }
}

minkeywordlength

Property

minkeywordlength

Data type

integer

Description

Minimum keyword length: Define the minimum length of a keyword to be highlighted

Default

{$plugin.tx_cpssearchhighlight.minkeywordlength}

numberofcolors

Property

numberofcolors

Data type

integer

Descriptionn

Number of different colors: Set the number of different colors (CSS-Styles) to use. Keep in mind that you have to extend the CSS .tx-cpssearchhighlight-sword-X (X stands for the number of the keyword).

Default

{$plugin.tx_cpssearchhighlight.numberofcolors}

differentcolors

Property

differentcolors

Data type

boolean

Descriptionn

Enable different colors for different keywords

Default

{$plugin.tx_cpssearchhighlight.differentcolors}

Solr Integration

The extension provides a hook implementation for the ResultModifier in solr. Function provides integration of solr query words into field row and additional register, so you have access to the search words in stdWrap function for plugin.tx_solr.search.results.fieldRenderingInstructions.

Example:

plugin.tx_solr.search.results.fieldRenderingInstructions {
        link_with_params = CASE
        link_with_params {
                key.field = type

                pages = TEXT
                pages {
                        value.cObject = TEXT
                        value.cObject {
                                typolink {
                                        parameter.field = uid
                                        returnLast = url
                                        forceAbsoluteUrl = 1
                                }
                        }
                        typolink {
                                parameter.field = uid
                                additionalParams.data = register:SWORD_PARAMS
                        }
                }

                tx_news_domain_model_news = TEXT
                tx_news_domain_model_news {
                        field = title
                        typolink {
                                parameter = 179
                                additionalParams = &tx_news_pi1[controller]=News&tx_news_pi1[action]=detail&tx_news_pi1[news]={field:uid}&{register:SWORD_PARAMS}
                                additionalParams.insertData = 1
                                useCacheHash = 1
                        }
                }
        }
}