IndexedSearchUtility

class \TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility

Class with common methods used across various classes in the indexed search.

Implementation is provided by various people from the TYPO3 community.

Table of Contents

Methods

getExplodedSearchString()  : array
Takes a search-string (WITHOUT SLASHES or else it'll be a little spooky , NOW REMEMBER to unslash!!) Sets up search words with operators.
isMysqlFullTextEnabled()  : bool
If MySQL Fulltext feature is used, the DB tables "index_rel" and "index_words" are not in use and skipped in various places.
getOperator()  : string|null
This returns an SQL search-operator (eg. AND, OR, NOT) translated from the current localized set of operators (eg. in danish OG, ELLER, IKKE).
split()  : string[]|null
Used to split a search-word line up into elements to search for. This function will detect boolean words like AND and OR, + and -, and even find sentences encapsulated in "" This function could be re-written to be more clean and effective - yet it's not that important.

Methods

getExplodedSearchString()

Takes a search-string (WITHOUT SLASHES or else it'll be a little spooky , NOW REMEMBER to unslash!!) Sets up search words with operators.

public static getExplodedSearchString(string $sword, string $defaultOperator, array $operatorTranslateTable) : array

Parameters

$sword : string

The input search-word string.

$defaultOperator : string
$operatorTranslateTable : array

Return values

array

isMysqlFullTextEnabled()

If MySQL Fulltext feature is used, the DB tables "index_rel" and "index_words" are not in use and skipped in various places.

public static isMysqlFullTextEnabled() : bool

Return values

bool

getOperator()

This returns an SQL search-operator (eg. AND, OR, NOT) translated from the current localized set of operators (eg. in danish OG, ELLER, IKKE).

protected static getOperator(string $operator, array $operatorTranslateTable) : string|null

Parameters

$operator : string

The possible operator to find in the internal operator array.

$operatorTranslateTable : array

an array of possible operators

Return values

string|null —

If found, the SQL operator for the localized input operator.

split()

Used to split a search-word line up into elements to search for. This function will detect boolean words like AND and OR, + and -, and even find sentences encapsulated in "" This function could be re-written to be more clean and effective - yet it's not that important.

protected static split(string $origSword[, string $specchars = '+-' ][, string $delchars = '+.,-' ]) : string[]|null

Parameters

$origSword : string

The raw sword string from outside

$specchars : string = '+-'

Special chars which are used as operators (+- is default)

$delchars : string = '+.,-'

Special chars which are deleted if the append the searchword (+-., is default)

Return values

string[]|null —

Returns an ARRAY if there were search words, otherwise the return value may be unset.

On this page