IndexSearchRepository

Index search abstraction to search through the index

Internal

This class is a specific repository implementation and is not considered part of the Public TYPO3 API.

Table of Contents

Properties

$descendingSortOrderFlag  : bool
Descending sort order flag formally known as $this->piVars['desc']
$displayForbiddenRecords  : bool
Display forbidden records formally known as $this->conf['show.']['forbiddenRecords']
$externalParsers  : array<string|int, mixed>
External Parsers
$frontendUserGroupList  : string
Frontend User Group List
$joinPagesForQuery  : bool
formally known as $conf['search.']['searchSkipExtendToSubpagesChecking'] enabled through settings.searchSkipExtendToSubpagesChecking
$languageUid  : int
Language uid formally known as $this->piVars['lang']
$mediaType  : int
Media type formally known as $this->piVars['media']
$numberOfResults  : int
Number of results formally known as $this->piVars['result']
$resultpagePointer  : int
Result page pointer formally known as $this->piVars['pointer']
$searchRootPageIdList  : string
list of all root pages that will be used If this value is set to less than zero (eg. -1) searching will happen in ALL of the page tree with no regard to branches at all.
$searchType  : int
Search type formally known as $this->piVars['type']
$sections  : string
Sections formally known as $this->piVars['sections']
$sortOrder  : string
Sort order formally known as $this->piVars['sort_order']
$useExactCount  : bool
Flag for exact search count formally known as $conf['search.']['exactCount']
$wSelClauses  : array<string|int, mixed>
Select clauses for individual words, will be filled during the search

Methods

doSearch()  : bool|array<string|int, mixed>
Get search result rows / data from database. Returned as data in array.
freeIndexUidWhere()  : string
Where-clause for free index-uid value.
getJoinPagesForQuery()  : bool
Getter for joinPagesForQuery flag enabled through TypoScript 'settings.skipExtendToSubpagesChecking'
getSearchRootPageIdList()  : array<string|int, int>
A list of integer which should be root-pages to search from
getSearchType()  : int
Search type e.g. sentence (20), any part of the word (1)
hookRequest()  : object|null
Returns an object reference to the hook object if any
initialize()  : mixed
initialize all options that are necessary for the search
languageWhere()  : string
Returns AND statement for selection of language
mediaTypeWhere()  : string
Returns AND statement for selection of media type
sectionTableWhere()  : string
Returns AND statement for selection of section in database. (rootlevel 0-2 + page_id)
checkResume()  : bool
Checking if the resume can be shown for the search result (depending on whether the rights are OK) ? Should it also check for gr_list "0,-1"?
execFinalQuery()  : Result
Execute final query, based on phash integer list. The main point is sorting the result in the right order.
execFinalQuery_fulltext()  : Result
Execute final query, based on phash integer list. The main point is sorting the result in the right order.
execPHashListQuery()  : Result|int
Returns a query which selects the search-word from the word/rel tables.
getDescendingSortOrderFlag()  : string
Returns "DESC" or "" depending on the settings of the incoming highest/lowest result order (piVars['desc'])
getPhashList()  : string
Returns a COMPLETE list of phash-integers matching the search-result composed of the search-words in the $searchWords array.
getResultRows_SQLpointer()  : Result|int|bool
Gets a SQL result pointer to traverse for the search records.
getResultRows_SQLpointerMysqlFulltext()  : Result|int|bool
Gets a SQL result pointer to traverse for the search records.
getSearchString()  : array<string|int, mixed>
Returns a search string for use with MySQL FULLTEXT query
getTimeTracker()  : TimeTracker
getTypoScriptFrontendController()  : TypoScriptFrontendController
isTableUsed()  : bool
Check if the tables provided are configured for usage.
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.
multiplePagesType()  : bool
Returns if an item type is a multipage item type
searchDistinct()  : Result
Search for one distinct word
searchMetaphone()  : Result
Search for a metaphone word
searchSentence()  : Result
Search for a sentence
searchWord()  : Result
Search for a word

Properties

$descendingSortOrderFlag

Descending sort order flag formally known as $this->piVars['desc']

protected bool $descendingSortOrderFlag

$displayForbiddenRecords

Display forbidden records formally known as $this->conf['show.']['forbiddenRecords']

protected bool $displayForbiddenRecords = false

enabled through settings.displayForbiddenRecords

$externalParsers

External Parsers

protected array<string|int, mixed> $externalParsers = []

$frontendUserGroupList

Frontend User Group List

protected string $frontendUserGroupList = ''

$joinPagesForQuery

formally known as $conf['search.']['searchSkipExtendToSubpagesChecking'] enabled through settings.searchSkipExtendToSubpagesChecking

protected bool $joinPagesForQuery = false

$languageUid

Language uid formally known as $this->piVars['lang']

protected int $languageUid

$mediaType

Media type formally known as $this->piVars['media']

protected int $mediaType

$numberOfResults

Number of results formally known as $this->piVars['result']

protected int $numberOfResults = 10

$resultpagePointer

Result page pointer formally known as $this->piVars['pointer']

protected int $resultpagePointer = 0

$searchRootPageIdList

list of all root pages that will be used If this value is set to less than zero (eg. -1) searching will happen in ALL of the page tree with no regard to branches at all.

protected string $searchRootPageIdList = ''

$searchType

Search type formally known as $this->piVars['type']

protected int $searchType = 0

$sections

Sections formally known as $this->piVars['sections']

protected string $sections

$sortOrder

Sort order formally known as $this->piVars['sort_order']

protected string $sortOrder = ''

$useExactCount

Flag for exact search count formally known as $conf['search.']['exactCount']

protected bool $useExactCount = false

Continue counting and checking of results even if we are sure they are not displayed in this request. This will slow down your page rendering, but it allows precise search result counters. enabled through settings.exactCount

$wSelClauses

Select clauses for individual words, will be filled during the search

protected array<string|int, mixed> $wSelClauses = []

Methods

doSearch()

Get search result rows / data from database. Returned as data in array.

public doSearch(array<string|int, mixed> $searchWords[, int $freeIndexUid = -1 ]) : bool|array<string|int, mixed>
Parameters
$searchWords : array<string|int, mixed>

Search word array

$freeIndexUid : int = -1

Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.

Return values
bool|array<string|int, mixed>

FALSE if no result, otherwise an array with keys for first row, result rows and total number of results found.

freeIndexUidWhere()

Where-clause for free index-uid value.

public freeIndexUidWhere(int $freeIndexUid) : string
Parameters
$freeIndexUid : int

Free Index UID value to limit search to.

Return values
string

WHERE SQL clause part.

getJoinPagesForQuery()

Getter for joinPagesForQuery flag enabled through TypoScript 'settings.skipExtendToSubpagesChecking'

public getJoinPagesForQuery() : bool
Return values
bool

getSearchRootPageIdList()

A list of integer which should be root-pages to search from

public getSearchRootPageIdList() : array<string|int, int>
Return values
array<string|int, int>

getSearchType()

Search type e.g. sentence (20), any part of the word (1)

public getSearchType() : int
Return values
int

hookRequest()

Returns an object reference to the hook object if any

public hookRequest(string $functionName) : object|null
Parameters
$functionName : string

Name of the function you want to call / hook key

Return values
object|null

Hook object, if any. Otherwise NULL.

initialize()

initialize all options that are necessary for the search

public initialize(array<string|int, mixed> $settings, array<string|int, mixed> $searchData, array<string|int, mixed> $externalParsers, string $searchRootPageIdList) : mixed
Parameters
$settings : array<string|int, mixed>

the extbase plugin settings

$searchData : array<string|int, mixed>

the search data

$externalParsers : array<string|int, mixed>
$searchRootPageIdList : string

languageWhere()

Returns AND statement for selection of language

public languageWhere() : string
Return values
string

AND statement for selection of language

mediaTypeWhere()

Returns AND statement for selection of media type

public mediaTypeWhere() : string
Return values
string

AND statement for selection of media type

sectionTableWhere()

Returns AND statement for selection of section in database. (rootlevel 0-2 + page_id)

public sectionTableWhere() : string
Return values
string

AND clause for selection of section in database.

checkResume()

Checking if the resume can be shown for the search result (depending on whether the rights are OK) ? Should it also check for gr_list "0,-1"?

protected checkResume(array<string|int, mixed> $row) : bool
Parameters
$row : array<string|int, mixed>

Result row array.

Return values
bool

Returns TRUE if resume can safely be shown

execFinalQuery()

Execute final query, based on phash integer list. The main point is sorting the result in the right order.

protected execFinalQuery(string $list[, int $freeIndexUid = -1 ]) : Result
Parameters
$list : string

List of phash integers which match the search.

$freeIndexUid : int = -1

Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.

Return values
Result

execFinalQuery_fulltext()

Execute final query, based on phash integer list. The main point is sorting the result in the right order.

protected execFinalQuery_fulltext(array<string|int, mixed> $searchData[, int $freeIndexUid = -1 ]) : Result

mysql fulltext specific helper method

Parameters
$searchData : array<string|int, mixed>

Array with search string, boolean indicator, and fulltext index reference

$freeIndexUid : int = -1

Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.

Return values
Result

execPHashListQuery()

Returns a query which selects the search-word from the word/rel tables.

protected execPHashListQuery(string $wordSel[, string $additionalWhereClause = '' ]) : Result|int
Parameters
$wordSel : string

WHERE clause selecting the word from phash

$additionalWhereClause : string = ''

Additional AND clause in the end of the query.

Return values
Result|int

getDescendingSortOrderFlag()

Returns "DESC" or "" depending on the settings of the incoming highest/lowest result order (piVars['desc'])

protected getDescendingSortOrderFlag([bool $inverse = false ]) : string
Parameters
$inverse : bool = false

If TRUE, inverse the order which is defined by piVars['desc']

Return values
string

" DESC" or formerly known as tx_indexedsearch_pi->isDescending

getPhashList()

Returns a COMPLETE list of phash-integers matching the search-result composed of the search-words in the $searchWords array.

protected getPhashList(array<string|int, mixed> $searchWords) : string

The list of phash integers are unsorted and should be used for subsequent selection of index_phash records for display of the result.

Parameters
$searchWords : array<string|int, mixed>

Search word array

Return values
string

List of integers

getResultRows_SQLpointer()

Gets a SQL result pointer to traverse for the search records.

protected getResultRows_SQLpointer(array<string|int, mixed> $searchWords[, int $freeIndexUid = -1 ]) : Result|int|bool
Parameters
$searchWords : array<string|int, mixed>

Search words

$freeIndexUid : int = -1

Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.

Return values
Result|int|bool

getResultRows_SQLpointerMysqlFulltext()

Gets a SQL result pointer to traverse for the search records.

protected getResultRows_SQLpointerMysqlFulltext(array<string|int, mixed> $searchWordsArray[, int $freeIndexUid = -1 ]) : Result|int|bool

mysql fulltext specific version triggered by ext_conf_template setting 'useMysqlFulltext'

Parameters
$searchWordsArray : array<string|int, mixed>

Search words

$freeIndexUid : int = -1

Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.

Return values
Result|int|bool

DBAL result statement

getSearchString()

Returns a search string for use with MySQL FULLTEXT query

protected getSearchString(array<string|int, mixed> $searchWordArray) : array<string|int, mixed>

mysql fulltext specific helper method

Parameters
$searchWordArray : array<string|int, mixed>

Search word array

Return values
array<string|int, mixed>

Search string

isTableUsed()

Check if the tables provided are configured for usage.

protected isTableUsed(string $table_list) : bool

This becomes necessary for extensions that provide additional database functionality like indexed_search_mysql.

Parameters
$table_list : string

Comma-separated list of tables

Return values
bool

TRUE if given tables are enabled

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.

protected md5inthash(string $str) : int
Parameters
$str : string

String to hash

Return values
int

Integer interpretation of the md5 hash of input string.

multiplePagesType()

Returns if an item type is a multipage item type

protected multiplePagesType(string $itemType) : bool
Parameters
$itemType : string

Item type

Return values
bool

TRUE if multipage capable

searchDistinct()

Search for one distinct word

protected searchDistinct(string $sWord) : Result
Parameters
$sWord : string

the search word

Return values
Result

searchMetaphone()

Search for a metaphone word

protected searchMetaphone(string $sWord) : Result
Parameters
$sWord : string

the search word

Return values
Result

searchSentence()

Search for a sentence

protected searchSentence(string $sWord) : Result
Parameters
$sWord : string

the search word

Return values
Result

searchWord()

Search for a word

protected searchWord(string $sWord, int $wildcard) : Result
Parameters
$sWord : string

the search word

$wildcard : int

Bit-field of Utility\LikeWildcard

Return values
Result

        
On this page

Search results