Handles preparing to search for data and proxying to the source handler.

package XenForo_Search

 Methods

Constructor.

__construct(\XenForo_Model_Search $searchModel, \XenForo_Search_SourceHandler_Abstract $sourceHandler) 

Parameters

$searchModel

\XenForo_Model_Search

Search model

$sourceHandler

\XenForo_Search_SourceHandler_Abstractnull

Search source handler. Uses default if not specified.

Triggers an error.

error(\XenForo_Phrase | string $message, string $field) 

An error will prevent the search from going through.

Parameters

$message

\XenForo_Phrasestring

Error message

$field

string

Field error applies to

Gets all error messages.

getErrors() : array

Returns

arrayArray of strings and/or XenForo_Phrase objects

Gets all warning messages.

getWarnings() : array

Returns

arrayArray of strings and/or XenForo_Phrase objects

Determines if the searcher has errors.

hasErrors() : boolean

Returns

boolean

Performs a general search.

searchGeneral(string $searchQuery, array $constraints, string $order, integer $maxResults) : array

This will usually be across all types of content, but could be limited but only using standard constraints.

Parameters

$searchQuery

string

Text to search for

$constraints

array

Constraints to apply; handled by source handlers

$order

string

Ordering; handled by source handlers

$maxResults

integer

Maximum number of results to return

Returns

arraySearch results: [] => array(content type , id)

Performs a type specific search.

searchType(\XenForo_Search_DataHandler_Abstract $typeHandler, string $searchQuery, array $constraints, string $order, boolean $groupByDiscussion, integer $maxResults) : array

Parameters

$typeHandler

\XenForo_Search_DataHandler_Abstract

Data handler for the type of search

$searchQuery

string

Text to search for

$constraints

array

Constraints to apply; handled by source handlers

$order

string

Ordering; handled by source handlers

$groupByDiscussion

boolean

If true, fold/group the results by the discussion_id value

$maxResults

integer

Maximum number of results to return

Returns

arraySearch results: [] => array(content type , id)

Searches for content by a specific user.

searchUser(integer $userId, integer $maxDate, integer $maxResults) : array

Parameters

$userId

integer

$maxDate

integer

If >0, the only messages older than this will be found

$maxResults

integer

Returns

arraySearch results: [] => array(content type , id)

Sets the viewing user.

setUser(array $viewingUser) 

Parameters

$viewingUser

arraynull

Triggers a warning.

warning(\XenForo_Phrase | string $message, string $field) 

This will be shown to the user on the search results page.

Parameters

$message

\XenForo_Phrasestring

Warning message

$field

string

Field warning applies to

 Properties

 

Errors are fatal conditions that will prevent the search from happening.

$_errors : array

 

$_searchModel

$_searchModel : \XenForo_Model_Search

 

$_sourceHandler

$_sourceHandler : \XenForo_Search_SourceHandler_Abstract

 

User viewing for permission checks.

$_viewingUser : array | null | false

 

Warnings are messages that should be shown to the user in the search results, but do not prevent the search from happening.

$_warnings : array