TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository Class Reference
Inheritance diagram for TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository:
Tx_IndexedSearch_Domain_Repository_IndexSearchRepository

Public Member Functions

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

Public Attributes

const WILDCARD_LEFT = 1
 
const WILDCARD_RIGHT = 2
 

Protected Member Functions

 getResultRows_SQLpointer ($searchWords, $freeIndexUid=-1)
 
 execPHashListQuery ($wordSel, $additionalWhereClause='')
 
 searchWord ($sWord, $mode)
 
 searchDistinct ($sWord)
 
 searchSentence ($sWord)
 
 searchMetaphone ($sWord)
 
 sectionTableWhere ()
 
 execFinalQuery ($list, $freeIndexUid=-1)
 
 checkResume ($row)
 
 getDescendingSortOrderFlag ($inverse=FALSE)
 
 enableFields ($table)
 
 multiplePagesType ($itemType)
 
 md5inthash ($str)
 
 isTableUsed ($table_list)
 

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

Author
Kasper Skårhøj kaspe.nosp@m.rYYY.nosp@m.Y@typ.nosp@m.o3.c.nosp@m.om
Christian Jul Jensen chris.nosp@m.tian.nosp@m.@typo.nosp@m.3.co.nosp@m.m
Benjamin Mack benni.nosp@m.@typ.nosp@m.o3.or.nosp@m.g

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
boolean Returns TRUE if resume can safely be shown

Definition at line 668 of file IndexSearchRepository.php.

References $GLOBALS, 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
integer$freeIndexUidPointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Returns
boolean|array FALSE if no result, otherwise an array with keys for first row, result rows and total number of results found.

Definition at line 139 of file IndexSearchRepository.php.

References $GLOBALS, 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\hookRequest(), and TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\multiplePagesType().

◆ 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
stringThe table for which to get the where clause
booleanIf set, then you want NOT to filter out hidden records. Otherwise hidden record are filtered based on the current preview settings.
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 743 of file IndexSearchRepository.php.

References $GLOBALS.

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

◆ execFinalQuery()

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

◆ 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
stringWHERE clause selecting the word from phash
stringAdditional AND clause in the end of the query.
Returns
pointer SQL result pointer

Definition at line 354 of file IndexSearchRepository.php.

References $GLOBALS, 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)

Where-clause for free index-uid value.

Parameters
integerFree Index UID value to limit search to.
Returns
string WHERE SQL clause part.

Definition at line 513 of file IndexSearchRepository.php.

References $GLOBALS, $uid, TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\enableFields(), TYPO3\CMS\Core\Utility\GeneralUtility\revExplode(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

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

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

Definition at line 720 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 824 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 814 of file IndexSearchRepository.php.

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

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

◆ 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 Hook object, if any. Otherwise NULL.

Definition at line 788 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
mixed$searchRootPageIdList
Returns
void

Definition at line 104 of file IndexSearchRepository.php.

References TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\$externalParsers, $GLOBALS, TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\$searchRootPageIdList, 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
boolean TRUE if given tables are enabled

Definition at line 778 of file IndexSearchRepository.php.

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 langauge

Definition at line 500 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
integer Integer intepretation of the md5 hash of input string.

Definition at line 766 of file IndexSearchRepository.php.

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

References $GLOBALS.

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

◆ multiplePagesType()

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

Returns if an item type is a multipage item type

Parameters
stringItem type
Returns
boolean TRUE if multipage capable

Definition at line 753 of file IndexSearchRepository.php.

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

◆ 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
stringthe search word
Returns
pointer SQL result pointer

Definition at line 413 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

Search for a sentence

Parameters
stringthe search word
Returns
pointer SQL result pointer

Definition at line 399 of file IndexSearchRepository.php.

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

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

◆ searchWord()

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

Search for a word

Parameters
stringthe search word
integerconstant from this class to see if the wildcard should be left and/or right of the search string
Returns
pointer SQL result pointer

Definition at line 371 of file IndexSearchRepository.php.

References $GLOBALS, 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 ( )
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 425 of file IndexSearchRepository.php.

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

Referenced by TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execPHashListQuery(), and TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\searchSentence().

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

◆ $externalParsers

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

◆ $frontendUserGroupList

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

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

◆ $mediaType

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

Definition at line 48 of file IndexSearchRepository.php.

◆ $numberOfResults

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

Definition at line 60 of file IndexSearchRepository.php.

◆ $resultpagePointer

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

Definition at line 57 of file IndexSearchRepository.php.

◆ $searchRootPageIdList

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

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

◆ $searchType

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

◆ $sections

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

Definition at line 39 of file IndexSearchRepository.php.

◆ $sortOrder

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

Definition at line 51 of file IndexSearchRepository.php.

◆ $useExactCount

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

Definition at line 86 of file IndexSearchRepository.php.

◆ $wSelClauses

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

Definition at line 79 of file IndexSearchRepository.php.

◆ WILDCARD_LEFT

const TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::WILDCARD_LEFT = 1

Definition at line 93 of file IndexSearchRepository.php.

◆ WILDCARD_RIGHT

const TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::WILDCARD_RIGHT = 2

Definition at line 94 of file IndexSearchRepository.php.