IndexedSearchUtility

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

Implementation is provided by various people from the TYPO3 community.

Internal

Table of Contents

Methods

getExplodedSearchString()  : array<string|int, mixed>
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()  : array<string|int, 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<string|int, mixed> $operatorTranslateTable) : array<string|int, mixed>
Parameters
$sword : string

The input search-word string.

$defaultOperator : string
$operatorTranslateTable : array<string|int, mixed>
Return values
array<string|int, mixed>

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<string|int, mixed> $operatorTranslateTable) : string|null
Parameters
$operator : string

The possible operator to find in the internal operator array.

$operatorTranslateTable : array<string|int, mixed>

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 = '+.,-' ]) : array<string|int, 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
array<string|int, string>|null

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


        
On this page

Search results