‪TYPO3CMS  ‪main
TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository Class Reference

Public Member Functions

 initialize (array $settings, array $searchData, array $externalParsers, int|string $searchRootPageIdList)
 
array false doSearch (array $searchWords, int $freeIndexUid)
 
 writeSearchStat (int $pageId, array $searchWords)
 
 getFullTextRowByPhash (int $phash)
 
 getIndexConfigurationById (int $id)
 

Protected Member Functions

 getResultRows_SQLpointer (array $searchWords, int $freeIndexUid)
 
 getResultRows_SQLpointerMysqlFulltext (array $searchWordsArray, int $freeIndexUid)
 
array getSearchString (array $searchWordArray)
 
 execFinalQuery_fulltext (array $searchData, int $freeIndexUid)
 
string getPhashList (array $searchWords)
 
 execPHashListQuery (string $wordSel, string $additionalWhereClause)
 
 searchWord (string $sWord, LikeWildcard $likeWildcard)
 
 searchDistinct (string $sWord)
 
 searchSentence (string $sWord)
 
 searchMetaphone (string $sWord)
 
string sectionTableWhere ()
 
string mediaTypeWhere ()
 
string languageWhere ()
 
string freeIndexUidWhere (int $freeIndexUid)
 
 execFinalQuery (string $list, int $freeIndexUid)
 
bool checkResume (array $row)
 
string getDescendingSortOrderFlag (bool $inverse=false)
 
bool multiplePagesType (string $itemType)
 
object null hookRequest (string $functionName)
 
 getSearchType ()
 
int[] getSearchRootPageIdList ()
 
 getTypoScriptFrontendController ()
 
 getTimeTracker ()
 

Protected Attributes

array $externalParsers = []
 
string $frontendUserGroupList = ''
 
string $sections = ''
 
int $searchType = 0
 
int $languageUid = 0
 
int $mediaType = 0
 
string $sortOrder = ''
 
bool $descendingSortOrderFlag = false
 
int $resultpagePointer = 0
 
int $numberOfResults = 10
 
string $searchRootPageIdList = ''
 
array $wSelClauses = []
 
bool $useExactCount = false
 
bool $displayForbiddenRecords = false
 

Detailed Description

Index search abstraction to search through the index

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

Definition at line 42 of file IndexSearchRepository.php.

Member Function Documentation

◆ checkResume()

bool TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::checkResume ( array  $row)
protected

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"?

Parameters
array$row‪Result row array.
Returns
‪bool Returns TRUE if resume can safely be shown

Definition at line 1101 of file IndexSearchRepository.php.

References TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility\isTableUsed().

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\doSearch().

◆ doSearch()

array false TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::doSearch ( array  $searchWords,
int  $freeIndexUid 
)

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

Parameters
array$searchWords‪Search word array
int$freeIndexUid‪Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Returns
‪array|false FALSE if no result, otherwise an array with keys for first row, result rows and total number of results found.

Definition at line 169 of file IndexSearchRepository.php.

References TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\checkResume(), TYPO3\CMS\Core\Utility\MathUtility\forceIntegerInRange(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getResultRows_SQLpointer(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getResultRows_SQLpointerMysqlFulltext(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getTimeTracker(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\hookRequest(), and TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\multiplePagesType().

◆ execFinalQuery()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::execFinalQuery ( string  $list,
int  $freeIndexUid 
)
protected

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

Parameters
string$list‪List of phash integers which match the search.
int$freeIndexUid‪Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.

Definition at line 948 of file IndexSearchRepository.php.

References TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getDescendingSortOrderFlag(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getTypoScriptFrontendController(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\hookRequest(), and TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getResultRows_SQLpointer().

◆ execFinalQuery_fulltext()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::execFinalQuery_fulltext ( array  $searchData,
int  $freeIndexUid 
)
protected

◆ execPHashListQuery()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::execPHashListQuery ( string  $wordSel,
string  $additionalWhereClause 
)
protected

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

Parameters
string$wordSel‪WHERE clause selecting the word from phash
string$additionalWhereClause‪Additional AND clause in the end of the query.

Definition at line 658 of file IndexSearchRepository.php.

References TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\searchDistinct(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\searchMetaphone(), and TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\searchWord().

◆ freeIndexUidWhere()

string TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::freeIndexUidWhere ( int  $freeIndexUid)
protected

Where-clause for free index-uid value.

Parameters
int$freeIndexUid‪Free Index UID value to limit search to.
Returns
‪string WHERE SQL clause part.

Definition at line 870 of file IndexSearchRepository.php.

References TYPO3\CMS\Webhooks\Message\$uid, and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery_fulltext().

◆ getDescendingSortOrderFlag()

string TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getDescendingSortOrderFlag ( bool  $inverse = false)
protected

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

Parameters
bool$inverse‪If TRUE, inverse the order which is defined by piVars['desc']
Returns
‪string " DESC" or formerly known as tx_indexedsearch_pi->isDescending

Definition at line 1160 of file IndexSearchRepository.php.

References TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\$descendingSortOrderFlag.

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery().

◆ getFullTextRowByPhash()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getFullTextRowByPhash ( int  $phash)

◆ getIndexConfigurationById()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getIndexConfigurationById ( int  $id)

◆ getPhashList()

string TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getPhashList ( array  $searchWords)
protected

◆ getResultRows_SQLpointer()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getResultRows_SQLpointer ( array  $searchWords,
int  $freeIndexUid 
)
protected

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

Parameters
array$searchWords‪Search words
int$freeIndexUid‪Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.

Definition at line 335 of file IndexSearchRepository.php.

References TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getPhashList(), and TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getTimeTracker().

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\doSearch().

◆ getResultRows_SQLpointerMysqlFulltext()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getResultRows_SQLpointerMysqlFulltext ( array  $searchWordsArray,
int  $freeIndexUid 
)
protected

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

mysql fulltext specific version triggered by ext_conf_template setting 'useMysqlFulltext'

Parameters
array$searchWordsArray‪Search words
int$freeIndexUid‪Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.

Definition at line 359 of file IndexSearchRepository.php.

References TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery_fulltext(), and TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getSearchString().

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\doSearch().

◆ getSearchRootPageIdList()

int [] TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getSearchRootPageIdList ( )
protected

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

Returns
‪int[]

Definition at line 1215 of file IndexSearchRepository.php.

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery_fulltext().

◆ getSearchString()

array TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getSearchString ( array  $searchWordArray)
protected

Returns a search string for use with MySQL FULLTEXT query

mysql fulltext specific helper method

Parameters
array$searchWordArray‪Search word array
Returns
‪array Search string

Definition at line 392 of file IndexSearchRepository.php.

References TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\$searchType, and TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getSearchType().

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getResultRows_SQLpointerMysqlFulltext().

◆ getSearchType()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getSearchType ( )
protected

◆ getTimeTracker()

◆ getTypoScriptFrontendController()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getTypoScriptFrontendController ( )
protected

◆ hookRequest()

object null TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::hookRequest ( string  $functionName)
protected

Returns an object reference to the hook object if any

Parameters
string$functionName‪Name of the function you want to call / hook key
Returns
‪object|null Hook object, if any. Otherwise NULL.

Definition at line 1188 of file IndexSearchRepository.php.

References $GLOBALS.

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\doSearch(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery(), and TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery_fulltext().

◆ initialize()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::initialize ( array  $settings,
array  $searchData,
array  $externalParsers,
int|string  $searchRootPageIdList 
)

initialize all options that are necessary for the search

Parameters
array$settings‪the extbase plugin settings
array$searchData‪the search data

Definition at line 139 of file IndexSearchRepository.php.

References TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\$externalParsers, and TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\$searchRootPageIdList.

◆ languageWhere()

string TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::languageWhere ( )
protected

Returns AND statement for selection of language

Returns
‪string AND statement for selection of language

Definition at line 850 of file IndexSearchRepository.php.

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery_fulltext().

◆ mediaTypeWhere()

string TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::mediaTypeWhere ( )
protected

Returns AND statement for selection of media type

Returns
‪string AND statement for selection of media type

Definition at line 819 of file IndexSearchRepository.php.

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery_fulltext().

◆ multiplePagesType()

bool TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::multiplePagesType ( string  $itemType)
protected

Returns if an item type is a multipage item type

Parameters
string$itemType‪Item type
Returns
‪bool TRUE if multipage capable

Definition at line 1175 of file IndexSearchRepository.php.

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\doSearch().

◆ searchDistinct()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::searchDistinct ( string  $sWord)
protected

◆ searchMetaphone()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::searchMetaphone ( string  $sWord)
protected

Search for a metaphone word

Parameters
string$sWord‪the search word

Definition at line 741 of file IndexSearchRepository.php.

References TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execPHashListQuery().

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getPhashList().

◆ searchSentence()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::searchSentence ( string  $sWord)
protected

Search for a sentence

Parameters
string$sWord‪the search word

Definition at line 713 of file IndexSearchRepository.php.

References TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getPhashList().

◆ searchWord()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::searchWord ( string  $sWord,
LikeWildcard  $likeWildcard 
)
protected

◆ sectionTableWhere()

string TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::sectionTableWhere ( )
protected

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

Returns
‪string AND clause for selection of section in database.

Definition at line 756 of file IndexSearchRepository.php.

References $GLOBALS.

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery_fulltext().

◆ writeSearchStat()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::writeSearchStat ( int  $pageId,
array  $searchWords 
)

Write statistics information to database for the search operation if there was at least one search word.

Parameters
array$searchWords‪Search Word array

Definition at line 271 of file IndexSearchRepository.php.

References $GLOBALS, TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Database\Connection\PARAM_STR.

Member Data Documentation

◆ $descendingSortOrderFlag

bool TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$descendingSortOrderFlag = false
protected

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

Definition at line 88 of file IndexSearchRepository.php.

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getDescendingSortOrderFlag().

◆ $displayForbiddenRecords

bool TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$displayForbiddenRecords = false
protected

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

enabled through settings.displayForbiddenRecords

Definition at line 131 of file IndexSearchRepository.php.

◆ $externalParsers

array TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$externalParsers = []
protected

◆ $frontendUserGroupList

string TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$frontendUserGroupList = ''
protected

Frontend User Group List

Definition at line 52 of file IndexSearchRepository.php.

◆ $languageUid

int TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$languageUid = 0
protected

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

Definition at line 70 of file IndexSearchRepository.php.

◆ $mediaType

int TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$mediaType = 0
protected

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

Definition at line 76 of file IndexSearchRepository.php.

◆ $numberOfResults

int TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$numberOfResults = 10
protected

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

Definition at line 100 of file IndexSearchRepository.php.

◆ $resultpagePointer

int TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$resultpagePointer = 0
protected

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

Definition at line 94 of file IndexSearchRepository.php.

◆ $searchRootPageIdList

string TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$searchRootPageIdList = ''
protected

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.

Definition at line 107 of file IndexSearchRepository.php.

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery_fulltext(), and TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\initialize().

◆ $searchType

int TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$searchType = 0
protected

◆ $sections

string TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$sections = ''
protected

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

Definition at line 58 of file IndexSearchRepository.php.

◆ $sortOrder

string TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$sortOrder = ''
protected

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

Definition at line 82 of file IndexSearchRepository.php.

◆ $useExactCount

bool TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$useExactCount = false
protected

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

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

Definition at line 123 of file IndexSearchRepository.php.

◆ $wSelClauses

array TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$wSelClauses = []
protected

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

Definition at line 112 of file IndexSearchRepository.php.