TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository Class Reference

Public Member Functions

 initialize ($settings, $searchData, $externalParsers, $searchRootPageIdList)
 
 doSearch ($searchWords, $freeIndexUid=-1)
 
 sectionTableWhere ()
 
 mediaTypeWhere ()
 
 languageWhere ()
 
 freeIndexUidWhere ($freeIndexUid)
 
 hookRequest ($functionName)
 
 getSearchType ()
 
 getSearchRootPageIdList ()
 
 getJoinPagesForQuery ()
 

Protected Member Functions

 getResultRows_SQLpointer ($searchWords, $freeIndexUid=-1)
 
 execPHashListQuery ($wordSel, $additionalWhereClause='')
 
 searchWord ($sWord, $wildcard)
 
 searchDistinct ($sWord)
 
 searchSentence ($sWord)
 
 searchMetaphone ($sWord)
 
 execFinalQuery ($list, $freeIndexUid=-1)
 
 checkResume ($row)
 
 getDescendingSortOrderFlag ($inverse=false)
 
 enableFields ($table)
 
 md5inthash ($str)
 
 isTableUsed ($table_list)
 
 getDatabaseConnection ()
 
 getTypoScriptFrontendController ()
 
 getTimeTracker ()
 

Protected Attributes

 $indexerObj
 
 $externalParsers = []
 
 $frontendUserGroupList = ''
 
 $sections = null
 
 $searchType = null
 
 $languageUid = null
 
 $mediaType = null
 
 $sortOrder = null
 
 $descendingSortOrderFlag = null
 
 $resultpagePointer = 0
 
 $numberOfResults = 10
 
 $searchRootPageIdList
 
 $joinPagesForQuery = false
 
 $wSelClauses = []
 
 $useExactCount = false
 
 $displayForbiddenRecords = false
 

Detailed Description

Index search abstraction to search through the index

Definition at line 25 of file IndexSearchRepository.php.

Member Function Documentation

◆ checkResume()

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$rowResult row array.
Returns
bool Returns TRUE if resume can safely be shown

Definition at line 756 of file IndexSearchRepository.php.

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

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

◆ doSearch()

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

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

Parameters
array$searchWordsSearch word array
int$freeIndexUidPointer 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 204 of file IndexSearchRepository.php.

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

◆ enableFields()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::enableFields (   $table)
protected

Returns a part of a WHERE clause which will filter out records with start/end times or hidden/fe_groups fields set to values that should de-select them according to the current time, preview settings or user login. Definitely a frontend function. THIS IS A VERY IMPORTANT FUNCTION: Basically you must add the output from this function for EVERY select query you create for selecting records of tables in your own applications - thus they will always be filtered according to the "enablefields" configured in TCA Simply calls ::enableFields() BUT will send the show_hidden flag along! This means this function will work in conjunction with the preview facilities of the frontend engine/Admin Panel.

Parameters
string$tableThe table for which to get the where clause
Returns
string The part of the where clause on the form " AND [fieldname]=0 AND ...". Eg. " AND hidden=0 AND starttime < 123345567
See also
::enableFields()

Definition at line 832 of file IndexSearchRepository.php.

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

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

◆ execFinalQuery()

◆ execPHashListQuery()

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$wordSelWHERE clause selecting the word from phash
string$additionalWhereClauseAdditional AND clause in the end of the query.
Returns
bool| SQL result pointer

Definition at line 424 of file IndexSearchRepository.php.

References TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getDatabaseConnection(), and TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\sectionTableWhere().

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()

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

◆ getDatabaseConnection()

◆ getDescendingSortOrderFlag()

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$inverseIf TRUE, inverse the order which is defined by piVars['desc']
Returns
string " DESC" or tx_indexedsearch_pi->isDescending

Definition at line 809 of file IndexSearchRepository.php.

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

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

◆ getJoinPagesForQuery()

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

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

Returns
bool

Definition at line 923 of file IndexSearchRepository.php.

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

◆ getResultRows_SQLpointer()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getResultRows_SQLpointer (   $searchWords,
  $freeIndexUid = -1 
)
protected

◆ getSearchRootPageIdList()

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::getSearchRootPageIdList ( )

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

Returns
int[]

Definition at line 912 of file IndexSearchRepository.php.

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

◆ getSearchType()

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

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

Returns
int

Definition at line 902 of file IndexSearchRepository.php.

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

◆ getTimeTracker()

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

◆ getTypoScriptFrontendController()

◆ hookRequest()

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

Returns an object reference to the hook object if any

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

Definition at line 883 of file IndexSearchRepository.php.

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

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

◆ initialize()

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

initialize all options that are necessary for the search

Parameters
array$settingsthe extbase plugin settings
array$searchDatathe search data
array$externalParsers
string$searchRootPageIdList
Returns
void

Definition at line 168 of file IndexSearchRepository.php.

References TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\$externalParsers, TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\$searchRootPageIdList, TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getTypoScriptFrontendController(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ isTableUsed()

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_listComma-separated list of tables
Returns
bool TRUE if given tables are enabled

Definition at line 872 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\getResultRows_SQLpointer().

◆ languageWhere()

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

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

◆ md5inthash()

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$strString to hash
Returns
int Integer intepretation of the md5 hash of input string.

Definition at line 859 of file IndexSearchRepository.php.

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

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

◆ mediaTypeWhere()

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

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

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

◆ searchDistinct()

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

◆ searchMetaphone()

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

Search for a metaphone word

Parameters
string$sWordthe search word
Returns
bool| SQL result pointer

Definition at line 496 of file IndexSearchRepository.php.

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

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

◆ searchSentence()

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

◆ searchWord()

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

Search for a word

Parameters
string$sWordthe search word
int$wildcardBit-field of Utility
Returns
bool| SQL result pointer

Definition at line 441 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\getResultRows_SQLpointer().

◆ sectionTableWhere()

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

Member Data Documentation

◆ $descendingSortOrderFlag

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

◆ $displayForbiddenRecords

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

Definition at line 157 of file IndexSearchRepository.php.

◆ $externalParsers

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

◆ $frontendUserGroupList

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

Definition at line 46 of file IndexSearchRepository.php.

◆ $indexerObj

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$indexerObj
protected

◆ $joinPagesForQuery

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

◆ $languageUid

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

Definition at line 70 of file IndexSearchRepository.php.

◆ $mediaType

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

Definition at line 78 of file IndexSearchRepository.php.

◆ $numberOfResults

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

Definition at line 110 of file IndexSearchRepository.php.

◆ $resultpagePointer

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

Definition at line 102 of file IndexSearchRepository.php.

◆ $searchRootPageIdList

TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::$searchRootPageIdList
protected

◆ $searchType

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

◆ $sections

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

Definition at line 54 of file IndexSearchRepository.php.

◆ $sortOrder

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

Definition at line 86 of file IndexSearchRepository.php.

◆ $useExactCount

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

Definition at line 147 of file IndexSearchRepository.php.

◆ $wSelClauses

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

Definition at line 134 of file IndexSearchRepository.php.