Documentation

SearchApiInterface
in

Interface SearchApiInterface

Table of Contents

Methods

compressParams()  : string
Compresses $this->params to a string for use as an URL parameter.
indexedWordQuery()  : mixed
Search for indexed words.
initializeSearch()  : void
Sets whatever properties are necessary in order to perform the search.
isValid()  : bool
Whether this method is valid for implementation or not.
postCreated()  : void
Callback when a post is created.
postModified()  : void
Callback when a post is modified.
postRemoved()  : void
Callback when a post is removed.
prepareIndexes()  : void
Callback while preparing indexes for searching.
searchQuery()  : mixed
Callback for actually performing the search query.
searchSort()  : int
Callback function for usort used to sort the fulltext results.
setParticipants()  : void
Figures out which search result topics the user participated in.
supportsMethod()  : bool
Check whether the specific search operation can be performed by this API.
topicsMoved()  : void
Callback when a topic is moved.
topicsRemoved()  : void
Callback when a topic is removed.

Methods

compressParams()

Compresses $this->params to a string for use as an URL parameter.

public compressParams() : string
Return values
string

URL-safe variant of a Base64 string.

indexedWordQuery()

Search for indexed words.

public indexedWordQuery(array<string|int, mixed> $words, array<string|int, mixed> $search_data) : mixed
Parameters
$words : array<string|int, mixed>

An array of words

$search_data : array<string|int, mixed>

An array of search data

initializeSearch()

Sets whatever properties are necessary in order to perform the search.

public initializeSearch() : void

This is separate from the constructor because there are a number of other places where the search API will be loaded for other purposes.

isValid()

Whether this method is valid for implementation or not.

public isValid() : bool
Return values
bool

Whether or not this method is valid

postCreated()

Callback when a post is created.

public postCreated(array<string|int, mixed> &$msgOptions, array<string|int, mixed> &$topicOptions, array<string|int, mixed> &$posterOptions) : void
Parameters
$msgOptions : array<string|int, mixed>

An array of post data

$topicOptions : array<string|int, mixed>

An array of topic data

$posterOptions : array<string|int, mixed>

An array of info about the person who made this post

Tags
see
Msg::create()

postModified()

Callback when a post is modified.

public postModified(array<string|int, mixed> &$msgOptions, array<string|int, mixed> &$topicOptions, array<string|int, mixed> &$posterOptions) : void
Parameters
$msgOptions : array<string|int, mixed>

An array of post data

$topicOptions : array<string|int, mixed>

An array of topic data

$posterOptions : array<string|int, mixed>

An array of info about the person who made this post

Tags
see
Msg::modify()

postRemoved()

Callback when a post is removed.

public postRemoved(int $id_msg) : void
Parameters
$id_msg : int

The ID of the post that was removed

prepareIndexes()

Callback while preparing indexes for searching.

public prepareIndexes(string $word, array<string|int, mixed> &$wordsSearch, array<string|int, mixed> &$wordsExclude, bool $isExcluded) : void
Parameters
$word : string

A word to index

$wordsSearch : array<string|int, mixed>

Search words

$wordsExclude : array<string|int, mixed>

Words to exclude

$isExcluded : bool

Whether the specified word should be excluded

searchQuery()

Callback for actually performing the search query.

public searchQuery(array<string|int, mixed> $query_params, array<string|int, mixed> $searchWords, array<string|int, mixed> $excludedIndexWords, array<string|int, mixed> &$participants, array<string|int, mixed> &$searchArray) : mixed

All of the arguments for this method are deprecated as of SMF 3.0. The relevant data is directly accessible in the properties of SearchApi.

Parameters
$query_params : array<string|int, mixed>

An array of parameters for the query

$searchWords : array<string|int, mixed>

The words that were searched for

$excludedIndexWords : array<string|int, mixed>

Indexed words that should be excluded

$participants : array<string|int, mixed>
$searchArray : array<string|int, mixed>

searchSort()

Callback function for usort used to sort the fulltext results.

public searchSort(string $a, string $b) : int

the order of sorting is: large words, small words, large words that are excluded from the search, small words that are excluded.

Parameters
$a : string

Word A

$b : string

Word B

Return values
int

An integer indicating how the words should be sorted

setParticipants()

Figures out which search result topics the user participated in.

public setParticipants() : void

supportsMethod()

Check whether the specific search operation can be performed by this API.

public supportsMethod(string $methodName[, array<string|int, mixed> $query_params = [] ]) : bool

The operations are the functions listed in the interface, if not supported they need not be declared

Parameters
$methodName : string

The method

$query_params : array<string|int, mixed> = []

Any parameters for the query

Return values
bool

Whether or not the specified method is supported

topicsMoved()

Callback when a topic is moved.

public topicsMoved(array<string|int, mixed> $topics, int $board_to) : void
Parameters
$topics : array<string|int, mixed>

The ID(s) of the moved topic(s)

$board_to : int

The board that the topics were moved to

topicsRemoved()

Callback when a topic is removed.

public topicsRemoved(array<string|int, mixed> $topics) : void
Parameters
$topics : array<string|int, mixed>

The ID(s) of the removed topic(s)


        
On this page

Search results