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

Public Member Functions

 initialize ($settings, $searchData, $externalParsers, $searchRootPageIdList)
 
bool array doSearch ($searchWords, $freeIndexUid=-1)
 
string sectionTableWhere ()
 
string mediaTypeWhere ()
 
string languageWhere ()
 
string freeIndexUidWhere ($freeIndexUid)
 
object null hookRequest ($functionName)
 
int getSearchType ()
 
int[] getSearchRootPageIdList ()
 
bool getJoinPagesForQuery ()
 

Protected Member Functions

Doctrine DBAL Result int bool getResultRows_SQLpointer ($searchWords, $freeIndexUid=-1)
 
Doctrine DBAL Result int bool getResultRows_SQLpointerMysqlFulltext ($searchWordsArray, $freeIndexUid=-1)
 
array getSearchString ($searchWordArray)
 
Doctrine DBAL Result execFinalQuery_fulltext ($searchData, $freeIndexUid=-1)
 
string getPhashList ($searchWords)
 
Doctrine DBAL Result int execPHashListQuery ($wordSel, $additionalWhereClause='')
 
Doctrine DBAL Result searchWord ($sWord, $wildcard)
 
Doctrine DBAL Result searchDistinct ($sWord)
 
Doctrine DBAL Result searchSentence ($sWord)
 
Doctrine DBAL Result searchMetaphone ($sWord)
 
Doctrine DBAL Result execFinalQuery ($list, $freeIndexUid=-1)
 
bool checkResume ($row)
 
string getDescendingSortOrderFlag ($inverse=false)
 
bool multiplePagesType ($itemType)
 
int md5inthash ($str)
 
bool isTableUsed ($table_list)
 
TYPO3 CMS Frontend Controller TypoScriptFrontendController getTypoScriptFrontendController ()
 
TimeTracker getTimeTracker ()
 

Protected Attributes

array $externalParsers = array( )
 
string $frontendUserGroupList = ''
 
string $sections
 
int $searchType = 0
 
int $languageUid
 
int $mediaType
 
string $sortOrder = ''
 
bool $descendingSortOrderFlag
 
int $resultpagePointer = 0
 
int $numberOfResults = 10
 
string $searchRootPageIdList = ''
 
bool $joinPagesForQuery = false
 
array $wSelClauses = array( )
 
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 37 of file IndexSearchRepository.php.

Member Function Documentation

◆ checkResume()

bool TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::checkResume (   $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 1117 of file IndexSearchRepository.php.

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

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

◆ doSearch()

bool array TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::doSearch (   $searchWords,
  $freeIndexUid = -1 
)

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
‪bool|array FALSE if no result, otherwise an array with keys for first row, result rows and total number of results found.

Definition at line 192 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(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\multiplePagesType(), TYPO3\CMS\Core\TimeTracker\TimeTracker\pull(), and TYPO3\CMS\Core\TimeTracker\TimeTracker\push().

◆ execFinalQuery()

Doctrine DBAL Result TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::execFinalQuery (   $list,
  $freeIndexUid = -1 
)
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.
Returns
‪\Doctrine\DBAL\Result

Definition at line 945 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(), TYPO3\CMS\Core\Utility\GeneralUtility\intExplode(), TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

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

◆ execFinalQuery_fulltext()

Doctrine DBAL Result TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::execFinalQuery_fulltext (   $searchData,
  $freeIndexUid = -1 
)
protected

◆ execPHashListQuery()

Doctrine DBAL Result int TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::execPHashListQuery (   $wordSel,
  $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.
Returns
‪\Doctrine\DBAL\Result|int

Definition at line 647 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 (   $freeIndexUid)

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 865 of file IndexSearchRepository.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_INT, TYPO3\CMS\Core\Utility\GeneralUtility\revExplode(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

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

◆ getDescendingSortOrderFlag()

string TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getDescendingSortOrderFlag (   $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 1176 of file IndexSearchRepository.php.

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

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

◆ getJoinPagesForQuery()

bool TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getJoinPagesForQuery ( )

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

Returns
‪bool

Definition at line 1271 of file IndexSearchRepository.php.

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

◆ getPhashList()

◆ getResultRows_SQLpointer()

Doctrine DBAL Result int bool TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getResultRows_SQLpointer (   $searchWords,
  $freeIndexUid = -1 
)
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.
Returns
‪\Doctrine\DBAL\Result|int|bool

Definition at line 296 of file IndexSearchRepository.php.

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

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

◆ getResultRows_SQLpointerMysqlFulltext()

Doctrine DBAL Result int bool TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getResultRows_SQLpointerMysqlFulltext (   $searchWordsArray,
  $freeIndexUid = -1 
)
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.
Returns
‪\Doctrine\DBAL\Result|int|bool DBAL result statement

Definition at line 321 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 ( )

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

Returns
‪int[]

Definition at line 1260 of file IndexSearchRepository.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\intExplode().

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

◆ getSearchString()

array TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getSearchString (   $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 353 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()

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

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

Returns
‪int

Definition at line 1250 of file IndexSearchRepository.php.

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

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

◆ getTimeTracker()

◆ getTypoScriptFrontendController()

TYPO3 CMS Frontend Controller TypoScriptFrontendController TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getTypoScriptFrontendController ( )
protected
Returns
‪\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController

Definition at line 1279 of file IndexSearchRepository.php.

References $GLOBALS.

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

◆ hookRequest()

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

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 1231 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 (   $settings,
  $searchData,
  $externalParsers,
  $searchRootPageIdList 
)

initialize all options that are necessary for the search

Parameters
array$settings‪the extbase plugin settings
array$searchData‪the search data
array$externalParsers
string$searchRootPageIdList

Definition at line 158 of file IndexSearchRepository.php.

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

◆ isTableUsed()

bool TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::isTableUsed (   $table_list)
protected

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

Parameters
string$table_list‪Comma-separated list of tables
Returns
‪bool TRUE if given tables are enabled

Definition at line 1220 of file IndexSearchRepository.php.

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

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

◆ languageWhere()

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

Returns AND statement for selection of language

Returns
‪string AND statement for selection of language

Definition at line 845 of file IndexSearchRepository.php.

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

◆ md5inthash()

int TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::md5inthash (   $str)
protected

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.

Parameters
string$str‪String to hash
Returns
‪int Integer interpretation of the md5 hash of input string.

Definition at line 1207 of file IndexSearchRepository.php.

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

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

◆ mediaTypeWhere()

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

Returns AND statement for selection of media type

Returns
‪string AND statement for selection of media type

Definition at line 814 of file IndexSearchRepository.php.

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

◆ multiplePagesType()

bool TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::multiplePagesType (   $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 1191 of file IndexSearchRepository.php.

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

◆ searchDistinct()

Doctrine DBAL Result TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::searchDistinct (   $sWord)
protected

◆ searchMetaphone()

Doctrine DBAL Result TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::searchMetaphone (   $sWord)
protected

Search for a metaphone word

Parameters
string$sWord‪the search word
Returns
‪\Doctrine\DBAL\Result

Definition at line 736 of file IndexSearchRepository.php.

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

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

◆ searchSentence()

Doctrine DBAL Result TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::searchSentence (   $sWord)
protected

◆ searchWord()

Doctrine DBAL Result TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::searchWord (   $sWord,
  $wildcard 
)
protected

Search for a word

Parameters
string$sWord‪the search word
int$wildcard‪Bit-field of Utility\LikeWildcard
Returns
‪\Doctrine\DBAL\Result

Definition at line 673 of file IndexSearchRepository.php.

References TYPO3\CMS\Core\Type\Enumeration\cast(), and TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execPHashListQuery().

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

◆ sectionTableWhere()

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

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 751 of file IndexSearchRepository.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\GeneralUtility\intExplode().

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

Member Data Documentation

◆ $descendingSortOrderFlag

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

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

Definition at line 92 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 148 of file IndexSearchRepository.php.

◆ $externalParsers

array TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$externalParsers = array( )
protected

◆ $frontendUserGroupList

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

Frontend User Group List

Definition at line 49 of file IndexSearchRepository.php.

◆ $joinPagesForQuery

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

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

Definition at line 121 of file IndexSearchRepository.php.

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

◆ $languageUid

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

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

Definition at line 71 of file IndexSearchRepository.php.

◆ $mediaType

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

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

Definition at line 78 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 106 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 99 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 114 of file IndexSearchRepository.php.

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

◆ $searchType

◆ $sections

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

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

Definition at line 56 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 85 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 139 of file IndexSearchRepository.php.

◆ $wSelClauses

array TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$wSelClauses = array( )
protected

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

Definition at line 127 of file IndexSearchRepository.php.