TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
IndexSearchRepository Class Reference

Public Member Functions

 initialize ($settings, $searchData, $externalParsers, $searchRootPageIdList)
 
 doSearch ($searchWords, $freeIndexUid=-1)
 
 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)
 
 sectionTableWhere ()
 
 execFinalQuery ($list, $freeIndexUid=-1)
 
 checkResume ($row)
 
 getDescendingSortOrderFlag ($inverse=false)
 
 enableFields ($table)
 
 md5inthash ($str)
 
 isTableUsed ($table_list)
 
 getDatabaseConnection ()
 
 getTypoScriptFrontendController ()
 
 getTimeTracker ()
 

Protected Attributes

 $indexerObj
 
 $externalParsers = array()
 
 $frontendUserGroupList = ''
 
 $sections = null
 
 $searchType = null
 
 $languageUid = null
 
 $mediaType = null
 
 $sortOrder = null
 
 $descendingSortOrderFlag = null
 
 $resultpagePointer = 0
 
 $numberOfResults = 10
 
 $searchRootPageIdList
 
 $joinPagesForQuery = false
 
 $wSelClauses = array()
 
 $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 (   $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 IndexSearchRepository\getDatabaseConnection(), and IndexSearchRepository\isTableUsed().

Referenced by IndexSearchRepository\doSearch().

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 IndexSearchRepository\checkResume(), MathUtility\forceIntegerInRange(), IndexSearchRepository\getDatabaseConnection(), IndexSearchRepository\getResultRows_SQLpointer(), IndexSearchRepository\getTimeTracker(), and IndexSearchRepository\hookRequest().

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 IndexSearchRepository\getTypoScriptFrontendController().

Referenced by IndexSearchRepository\execFinalQuery(), and IndexSearchRepository\freeIndexUidWhere().

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$listList of phash integers which match the search.
int$freeIndexUidPointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Returns
bool| Query result pointer

Definition at line 643 of file IndexSearchRepository.php.

References $list, elseif, IndexSearchRepository\enableFields(), IndexSearchRepository\freeIndexUidWhere(), IndexSearchRepository\getDatabaseConnection(), IndexSearchRepository\getDescendingSortOrderFlag(), IndexSearchRepository\getTypoScriptFrontendController(), IndexSearchRepository\hookRequest(), GeneralUtility\intExplode(), IndexSearchRepository\languageWhere(), and IndexSearchRepository\mediaTypeWhere().

Referenced by IndexSearchRepository\getResultRows_SQLpointer().

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 IndexSearchRepository\getDatabaseConnection(), and IndexSearchRepository\sectionTableWhere().

Referenced by IndexSearchRepository\searchDistinct(), IndexSearchRepository\searchMetaphone(), and IndexSearchRepository\searchWord().

freeIndexUidWhere (   $freeIndexUid)

Where-clause for free index-uid value.

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

Definition at line 599 of file IndexSearchRepository.php.

References $list, IndexSearchRepository\enableFields(), IndexSearchRepository\getDatabaseConnection(), GeneralUtility\revExplode(), and GeneralUtility\trimExplode().

Referenced by IndexSearchRepository\execFinalQuery().

getDatabaseConnection ( )
protected
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 IndexSearchRepository\$descendingSortOrderFlag.

Referenced by IndexSearchRepository\execFinalQuery().

getJoinPagesForQuery ( )

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

Returns
bool

Definition at line 923 of file IndexSearchRepository.php.

References IndexSearchRepository\$joinPagesForQuery.

getResultRows_SQLpointer (   $searchWords,
  $freeIndexUid = -1 
)
protected

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

Parameters
array$searchWordsSearch words
int$freeIndexUidPointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Returns
bool|

Definition at line 298 of file IndexSearchRepository.php.

References $list, IndexSearchRepository\execFinalQuery(), and IndexSearchRepository\getTimeTracker().

Referenced by IndexSearchRepository\doSearch().

getSearchRootPageIdList ( )

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

Returns
int[]

Definition at line 912 of file IndexSearchRepository.php.

References GeneralUtility\intExplode().

getSearchType ( )

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

Returns
int

Definition at line 902 of file IndexSearchRepository.php.

References IndexSearchRepository\$searchType.

getTimeTracker ( )
protected
getTypoScriptFrontendController ( )
protected
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 GeneralUtility\getUserObj().

Referenced by IndexSearchRepository\doSearch(), and IndexSearchRepository\execFinalQuery().

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 IndexSearchRepository\$externalParsers, IndexSearchRepository\$searchRootPageIdList, IndexSearchRepository\getTypoScriptFrontendController(), and GeneralUtility\makeInstance().

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.

Referenced by IndexSearchRepository\checkResume().

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 IndexSearchRepository\execFinalQuery().

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.

Referenced by IndexSearchRepository\searchDistinct().

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 IndexSearchRepository\getDatabaseConnection().

Referenced by IndexSearchRepository\execFinalQuery().

searchDistinct (   $sWord)
protected

Search for one distinct word

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

Definition at line 459 of file IndexSearchRepository.php.

References IndexSearchRepository\execPHashListQuery(), and IndexSearchRepository\md5inthash().

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 IndexSearchRepository\execPHashListQuery().

searchSentence (   $sWord)
protected

Search for a sentence

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

Definition at line 472 of file IndexSearchRepository.php.

References LikeWildcard\BOTH, IndexSearchRepository\getDatabaseConnection(), and IndexSearchRepository\sectionTableWhere().

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 IndexSearchRepository\execPHashListQuery().

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

References $GLOBALS, $list, elseif, IndexSearchRepository\getTypoScriptFrontendController(), and GeneralUtility\intExplode().

Referenced by IndexSearchRepository\execPHashListQuery(), and IndexSearchRepository\searchSentence().

Member Data Documentation

$descendingSortOrderFlag = null
protected
$displayForbiddenRecords = false
protected

Definition at line 157 of file IndexSearchRepository.php.

$externalParsers = array()
protected

Definition at line 39 of file IndexSearchRepository.php.

Referenced by IndexSearchRepository\initialize().

$frontendUserGroupList = ''
protected

Definition at line 46 of file IndexSearchRepository.php.

$indexerObj
protected

Definition at line 32 of file IndexSearchRepository.php.

$joinPagesForQuery = false
protected
$languageUid = null
protected

Definition at line 70 of file IndexSearchRepository.php.

$mediaType = null
protected

Definition at line 78 of file IndexSearchRepository.php.

$numberOfResults = 10
protected

Definition at line 110 of file IndexSearchRepository.php.

$resultpagePointer = 0
protected

Definition at line 102 of file IndexSearchRepository.php.

$searchRootPageIdList
protected

Definition at line 119 of file IndexSearchRepository.php.

Referenced by IndexSearchRepository\initialize().

$searchType = null
protected

Definition at line 62 of file IndexSearchRepository.php.

Referenced by IndexSearchRepository\getSearchType().

$sections = null
protected

Definition at line 54 of file IndexSearchRepository.php.

$sortOrder = null
protected

Definition at line 86 of file IndexSearchRepository.php.

$useExactCount = false
protected

Definition at line 147 of file IndexSearchRepository.php.

$wSelClauses = array()
protected

Definition at line 134 of file IndexSearchRepository.php.