‪TYPO3CMS  ‪main
TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility Class Reference

Static Public Member Functions

static getExplodedSearchString (string $sword, string $defaultOperator, array $operatorTranslateTable)
static isMysqlFullTextEnabled ()

Static Protected Member Functions

static array< string > null split (string $origSword, string $specchars='+-', string $delchars='+.,-')
static string null getOperator (string $operator, array $operatorTranslateTable)

Detailed Description

Class with common methods used across various classes in the indexed search. Implementation is provided by various people from the TYPO3 community.

Definition at line 28 of file IndexedSearchUtility.php.

Member Function Documentation

◆ getExplodedSearchString()

static TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility::getExplodedSearchString ( string  $sword,
string  $defaultOperator,
array  $operatorTranslateTable 

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

string$sword‪The input search-word string.

Definition at line 36 of file IndexedSearchUtility.php.

References TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility\getOperator(), and TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility\split().

Referenced by TYPO3\CMS\IndexedSearch\Controller\SearchController\getSearchWords().

◆ getOperator()

static string null TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility::getOperator ( string  $operator,
array  $operatorTranslateTable 

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

string$operator‪The possible operator to find in the internal operator array.
array$operatorTranslateTable‪an array of possible operators
‪string|null If found, the SQL operator for the localized input operator.

Definition at line 126 of file IndexedSearchUtility.php.

Referenced by TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility\getExplodedSearchString().

◆ isMysqlFullTextEnabled()

static TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility::isMysqlFullTextEnabled ( )

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

Definition at line 148 of file IndexedSearchUtility.php.

◆ split()

static array<string> null TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility::split ( string  $origSword,
string  $specchars = '+-',
string  $delchars = '+.,

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.

string$origSword‪The raw sword string from outside
string$specchars‪Special chars which are used as operators (+- is default)
string$delchars‪Special chars which are deleted if the append the searchword (+-., is default)
‪array<string>|null Returns an ARRAY if there were search words, otherwise the return value may be unset.

Definition at line 71 of file IndexedSearchUtility.php.

Referenced by TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility\getExplodedSearchString().