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.
isTableUsed()  : bool
Check if the tables provided are configured for usage. This becomes necessary for extensions that provide additional database functionality like indexed_search_mysql.
md5inthash()  : int
md5 integer hash Using 7 instead of 8 just because that makes the integers lower than 32 bit (28 bit) and so they do not interfere with UNSIGNED integers or PHP-versions which has varying output from the hexdec function.
milliseconds()  : int
Gets the unixtime as milliseconds.
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>

isTableUsed()

Check if the tables provided are configured for usage. This becomes necessary for extensions that provide additional database functionality like indexed_search_mysql.

public static isTableUsed(string $tableName) : bool
Parameters
$tableName : string

Table name to check

Return values
bool

True if the given table is used

md5inthash()

md5 integer hash Using 7 instead of 8 just because that makes the integers lower than 32 bit (28 bit) and so they do not interfere with UNSIGNED integers or PHP-versions which has varying output from the hexdec function.

public static md5inthash(string $stringToHash) : int
Parameters
$stringToHash : string

String to hash

Return values
int

Integer interpretation of the md5 hash of input string.

milliseconds()

Gets the unixtime as milliseconds.

public static milliseconds() : int
Return values
int

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