IndexSearchRepository
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.
Table of Contents
Properties
- $descendingSortOrderFlag : bool
- Descending sort order flag formally known as $this->piVars['desc']
- $displayForbiddenRecords : bool
- Display forbidden records formally known as $this->conf['show.']['forbiddenRecords']
- $externalParsers : array<string|int, mixed>
- External Parsers
- $frontendUserGroupList : string
- Frontend User Group List
- $languageUid : int
- Language uid formally known as $this->piVars['lang']
- $mediaType : int|string
- Media type Can be either an integer value or a raw string formally known as $this->piVars['media']
- $numberOfResults : int
- Number of results formally known as $this->piVars['result']
- $resultpagePointer : int
- Result page pointer formally known as $this->piVars['pointer']
- $searchRootPageIdList : string
- 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.
- $searchType : int
- Search type formally known as $this->piVars['type']
- $sections : string
- Sections formally known as $this->piVars['sections']
- $sortOrder : string
- Sort order formally known as $this->piVars['sort_order']
- $useExactCount : bool
- Flag for exact search count formally known as $conf['search.']['exactCount']
- $wSelClauses : array<string|int, mixed>
- Select clauses for individual words, will be filled during the search
Methods
- doSearch() : array<string|int, mixed>|false
- Get search result rows / data from database. Returned as data in array.
- initialize() : void
- initialize all options that are necessary for the search
- checkResume() : bool
- 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"?
- execFinalQuery() : Result
- Execute final query, based on phash integer list. The main point is sorting the result in the right order.
- execFinalQuery_fulltext() : Result
- Execute final query, based on phash integer list. The main point is sorting the result in the right order.
- execPHashListQuery() : Result
- Returns a query which selects the search-word from the word/rel tables.
- freeIndexUidWhere() : string
- Where-clause for free index-uid value.
- getDescendingSortOrderFlag() : string
- Returns "DESC" or "" depending on the settings of the incoming highest/lowest result order (piVars['desc'])
- getPhashList() : string
- Returns a COMPLETE list of phash-integers matching the search-result composed of the search-words in the $searchWords array.
- getResultRows_SQLpointer() : Result|false
- Gets a SQL result pointer to traverse for the search records.
- getResultRows_SQLpointerMysqlFulltext() : Result|false
- Gets a SQL result pointer to traverse for the search records.
- getSearchRootPageIdList() : array<string|int, int>
- A list of integer which should be root-pages to search from
- getSearchString() : array<string|int, mixed>
- Returns a search string for use with MySQL FULLTEXT query
- getSearchType() : int
- Search type e.g. sentence (20), any part of the word (1)
- getTimeTracker() : TimeTracker
- getTypoScriptFrontendController() : TypoScriptFrontendController
- hookRequest() : object|null
- Returns an object reference to the hook object if any
- languageWhere() : string
- Returns AND statement for selection of language
- mediaTypeWhere() : string
- Returns AND statement for selection of media type
- multiplePagesType() : bool
- Returns if an item type is a multipage item type
- searchDistinct() : Result
- Search for one distinct word
- searchMetaphone() : Result
- Search for a metaphone word
- searchSentence() : Result
- Search for a sentence
- searchWord() : Result
- Search for a word
- sectionTableWhere() : string
- Returns AND statement for selection of section in database. (rootlevel 0-2 + page_id)
Properties
$descendingSortOrderFlag
Descending sort order flag formally known as $this->piVars['desc']
protected
bool
$descendingSortOrderFlag
= false
$displayForbiddenRecords
Display forbidden records formally known as $this->conf['show.']['forbiddenRecords']
protected
bool
$displayForbiddenRecords
= false
enabled through settings.displayForbiddenRecords
$externalParsers
External Parsers
protected
array<string|int, mixed>
$externalParsers
= []
$frontendUserGroupList
Frontend User Group List
protected
string
$frontendUserGroupList
= ''
$languageUid
Language uid formally known as $this->piVars['lang']
protected
int
$languageUid
= 0
$mediaType
Media type Can be either an integer value or a raw string formally known as $this->piVars['media']
protected
int|string
$mediaType
= 0
$numberOfResults
Number of results formally known as $this->piVars['result']
protected
int
$numberOfResults
= 10
$resultpagePointer
Result page pointer formally known as $this->piVars['pointer']
protected
int
$resultpagePointer
= 0
$searchRootPageIdList
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.
protected
string
$searchRootPageIdList
= ''
$searchType
Search type formally known as $this->piVars['type']
protected
int
$searchType
= 0
$sections
Sections formally known as $this->piVars['sections']
protected
string
$sections
= ''
$sortOrder
Sort order formally known as $this->piVars['sort_order']
protected
string
$sortOrder
= ''
$useExactCount
Flag for exact search count formally known as $conf['search.']['exactCount']
protected
bool
$useExactCount
= false
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
$wSelClauses
Select clauses for individual words, will be filled during the search
protected
array<string|int, mixed>
$wSelClauses
= []
Methods
doSearch()
Get search result rows / data from database. Returned as data in array.
public
doSearch(array<string|int, mixed> $searchWords, int $freeIndexUid) : array<string|int, mixed>|false
Parameters
- $searchWords : array<string|int, mixed>
-
Search word array
- $freeIndexUid : int
-
Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Return values
array<string|int, mixed>|false —FALSE if no result, otherwise an array with keys for first row, result rows and total number of results found.
initialize()
initialize all options that are necessary for the search
public
initialize(array<string|int, mixed> $settings, array<string|int, mixed> $searchData, array<string|int, mixed> $externalParsers, int|string $searchRootPageIdList) : void
Parameters
- $settings : array<string|int, mixed>
-
the extbase plugin settings
- $searchData : array<string|int, mixed>
-
the search data
- $externalParsers : array<string|int, mixed>
- $searchRootPageIdList : int|string
checkResume()
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"?
protected
checkResume(array<string|int, mixed> $row) : bool
Parameters
- $row : array<string|int, mixed>
-
Result row array.
Return values
bool —Returns TRUE if resume can safely be shown
execFinalQuery()
Execute final query, based on phash integer list. The main point is sorting the result in the right order.
protected
execFinalQuery(string $list, int $freeIndexUid) : Result
Parameters
- $list : string
-
List of phash integers which match the search.
- $freeIndexUid : int
-
Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Return values
ResultexecFinalQuery_fulltext()
Execute final query, based on phash integer list. The main point is sorting the result in the right order.
protected
execFinalQuery_fulltext(array<string|int, mixed> $searchData, int $freeIndexUid) : Result
mysql fulltext specific helper method
Parameters
- $searchData : array<string|int, mixed>
-
Array with search string, boolean indicator, and fulltext index reference
- $freeIndexUid : int
-
Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Return values
ResultexecPHashListQuery()
Returns a query which selects the search-word from the word/rel tables.
protected
execPHashListQuery(string $wordSel, string $additionalWhereClause) : Result
Parameters
- $wordSel : string
-
WHERE clause selecting the word from phash
- $additionalWhereClause : string
-
Additional AND clause in the end of the query.
Return values
ResultfreeIndexUidWhere()
Where-clause for free index-uid value.
protected
freeIndexUidWhere(int $freeIndexUid) : string
Parameters
- $freeIndexUid : int
-
Free Index UID value to limit search to.
Return values
string —WHERE SQL clause part.
getDescendingSortOrderFlag()
Returns "DESC" or "" depending on the settings of the incoming highest/lowest result order (piVars['desc'])
protected
getDescendingSortOrderFlag([bool $inverse = false ]) : string
Parameters
- $inverse : bool = false
-
If TRUE, inverse the order which is defined by piVars['desc']
Return values
string —" DESC" or formerly known as tx_indexedsearch_pi->isDescending
getPhashList()
Returns a COMPLETE list of phash-integers matching the search-result composed of the search-words in the $searchWords array.
protected
getPhashList(array<string|int, mixed> $searchWords) : string
The list of phash integers are unsorted and should be used for subsequent selection of index_phash records for display of the result.
Parameters
- $searchWords : array<string|int, mixed>
-
Search word array
Return values
string —List of integers
getResultRows_SQLpointer()
Gets a SQL result pointer to traverse for the search records.
protected
getResultRows_SQLpointer(array<string|int, mixed> $searchWords, int $freeIndexUid) : Result|false
Parameters
- $searchWords : array<string|int, mixed>
-
Search words
- $freeIndexUid : int
-
Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Return values
Result|falsegetResultRows_SQLpointerMysqlFulltext()
Gets a SQL result pointer to traverse for the search records.
protected
getResultRows_SQLpointerMysqlFulltext(array<string|int, mixed> $searchWordsArray, int $freeIndexUid) : Result|false
mysql fulltext specific version triggered by ext_conf_template setting 'useMysqlFulltext'
Parameters
- $searchWordsArray : array<string|int, mixed>
-
Search words
- $freeIndexUid : int
-
Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
Return values
Result|falsegetSearchRootPageIdList()
A list of integer which should be root-pages to search from
protected
getSearchRootPageIdList() : array<string|int, int>
Return values
array<string|int, int>getSearchString()
Returns a search string for use with MySQL FULLTEXT query
protected
getSearchString(array<string|int, mixed> $searchWordArray) : array<string|int, mixed>
mysql fulltext specific helper method
Parameters
- $searchWordArray : array<string|int, mixed>
-
Search word array
Return values
array<string|int, mixed> —Search string
getSearchType()
Search type e.g. sentence (20), any part of the word (1)
protected
getSearchType() : int
Return values
intgetTimeTracker()
protected
getTimeTracker() : TimeTracker
Return values
TimeTrackergetTypoScriptFrontendController()
protected
getTypoScriptFrontendController() : TypoScriptFrontendController
Return values
TypoScriptFrontendControllerhookRequest()
Returns an object reference to the hook object if any
protected
hookRequest(string $functionName) : object|null
Parameters
- $functionName : string
-
Name of the function you want to call / hook key
Return values
object|null —Hook object, if any. Otherwise NULL.
languageWhere()
Returns AND statement for selection of language
protected
languageWhere() : string
Return values
string —AND statement for selection of language
mediaTypeWhere()
Returns AND statement for selection of media type
protected
mediaTypeWhere() : string
Return values
string —AND statement for selection of media type
multiplePagesType()
Returns if an item type is a multipage item type
protected
multiplePagesType(string $itemType) : bool
Parameters
- $itemType : string
-
Item type
Return values
bool —TRUE if multipage capable
searchDistinct()
Search for one distinct word
protected
searchDistinct(string $sWord) : Result
Parameters
- $sWord : string
-
the search word
Return values
ResultsearchMetaphone()
Search for a metaphone word
protected
searchMetaphone(string $sWord) : Result
Parameters
- $sWord : string
-
the search word
Return values
ResultsearchSentence()
Search for a sentence
protected
searchSentence(string $sWord) : Result
Parameters
- $sWord : string
-
the search word
Return values
ResultsearchWord()
Search for a word
protected
searchWord(string $sWord, LikeWildcard $likeWildcard) : Result
Parameters
- $sWord : string
-
the search word
- $likeWildcard : LikeWildcard
Return values
ResultsectionTableWhere()
Returns AND statement for selection of section in database. (rootlevel 0-2 + page_id)
protected
sectionTableWhere() : string
Return values
string —AND clause for selection of section in database.