PHP Класс phpbb\search\fulltext_native

Наследование: extends phpbb\search\base
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$common_words array Common words are words with length less/more than min/max length
$config phpbb\config\config Config object
$db phpbb\db\driver\driver_interface Database connection
$must_contain_ids array Post ids of posts containing words that are to be included
$must_exclude_one_ids array Post ids of posts containing atleast one word that needs to be excluded
$must_not_contain_ids array Post ids of posts containing words that should not be included
$php_ext string PHP Extension
$phpbb_root_path string Relative path to board root
$search_query string Operators are prefixed in search query and common words excluded
$stats array Associative array holding index stats
$user phpbb\user User object
$word_length array Associative array stores the min and max word length to be searched

Открытые методы

Метод Описание
__construct ( &$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user ) Initialises the fulltext_native search backend with min/max word length
acp ( ) Returns a list of options for the ACP to display
author_search ( string $type, boolean $firstpost_only, array $sort_by_sql, string $sort_key, string $sort_dir, string $sort_days, array $ex_fid_ary, string $post_visibility, integer $topic_id, array $author_ary, string $author_name, &$id_ary, integer &$start, integer $per_page ) : boolean | integer Performs a search on an author's posts without caring about message contents. Depends on display specific params
delete_index ( $acp_module, $u_action ) Deletes all words from the index
get_common_words ( ) : array Returns the common_words array
get_name ( ) : string Returns the name of this search backend to be displayed to administrators
get_search_query ( ) : string Returns the search_query
get_word_length ( ) : array Returns the word_length array
index ( string $mode, integer $post_id, &$message, &$subject, integer $poster_id, integer $forum_id ) Updates wordlist and wordmatch tables when a message is posted or changed
index_created ( ) Returns true if both FULLTEXT indexes exist
index_remove ( $post_ids, $author_ids, $forum_ids ) Removes entries from the wordmatch table for the specified post_ids
index_stats ( ) Returns an associative array containing information about the indexes
keyword_search ( string $type, string $fields, string $terms, array $sort_by_sql, string $sort_key, string $sort_dir, string $sort_days, array $ex_fid_ary, string $post_visibility, integer $topic_id, array $author_ary, string $author_name, &$id_ary, integer &$start, integer $per_page ) : boolean | integer Performs a search on keywords depending on display specific params. You have to run split_keywords() first
split_keywords ( string $keywords, string $terms ) : boolean This function fills $this->search_query with the cleaned user search query
split_message ( string $text ) : array Split a text into words of a given length
tidy ( ) Tidy up indexes: Tag 'common words' and remove words no longer referenced in the match table

Защищенные методы

Метод Описание
cleanup ( string $text, string $allowed_chars = null, string $encoding = 'utf-8' ) : string Clean up a text to remove non-alphanumeric characters
get_stats ( )

Описание методов

__construct() публичный Метод

Initialises the fulltext_native search backend with min/max word length
public __construct ( &$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user )

acp() публичный Метод

Returns a list of options for the ACP to display
public acp ( )

cleanup() защищенный Метод

This method receives a UTF-8 string, normalizes and validates it, replaces all non-alphanumeric characters with strings then returns the result. Any number of "allowed chars" can be passed as a UTF-8 string in NFC.
protected cleanup ( string $text, string $allowed_chars = null, string $encoding = 'utf-8' ) : string
$text string Text to split, in UTF-8 (not normalized or sanitized)
$allowed_chars string String of special chars to allow
$encoding string Text encoding
Результат string Cleaned up text, only alphanumeric chars are left

delete_index() публичный Метод

Deletes all words from the index
public delete_index ( $acp_module, $u_action )

get_common_words() публичный Метод

Returns the common_words array
public get_common_words ( ) : array
Результат array common words that are ignored by search backend

get_name() публичный Метод

Returns the name of this search backend to be displayed to administrators
public get_name ( ) : string
Результат string Name

get_search_query() публичный Метод

Returns the search_query
public get_search_query ( ) : string
Результат string search query

get_stats() защищенный Метод

protected get_stats ( )

get_word_length() публичный Метод

Returns the word_length array
public get_word_length ( ) : array
Результат array min and max word length for searching

index() публичный Метод

Updates wordlist and wordmatch tables when a message is posted or changed
public index ( string $mode, integer $post_id, &$message, &$subject, integer $poster_id, integer $forum_id )
$mode string Contains the post mode: edit, post, reply, quote
$post_id integer The id of the post which is modified/created
$poster_id integer Post author's user id
$forum_id integer The id of the forum in which the post is located

index_created() публичный Метод

Returns true if both FULLTEXT indexes exist
public index_created ( )

index_remove() публичный Метод

Removes entries from the wordmatch table for the specified post_ids
public index_remove ( $post_ids, $author_ids, $forum_ids )

index_stats() публичный Метод

Returns an associative array containing information about the indexes
public index_stats ( )

split_keywords() публичный Метод

If $terms is 'any' then the words will be extracted from the search query and combined with | inside brackets. They will afterwards be treated like an standard search query. Then it analyses the query and fills the internal arrays $must_not_contain_ids, $must_contain_ids and $must_exclude_one_ids which are later used by keyword_search()
public split_keywords ( string $keywords, string $terms ) : boolean
$keywords string contains the search query string as entered by the user
$terms string is either 'all' (use search query as entered, default words to 'must be contained in post') or 'any' (find all posts containing at least one of the given words)
Результат boolean false if no valid keywords were found and otherwise true

split_message() публичный Метод

The text is converted to UTF-8, cleaned up, and split. Then, words that conform to the defined length range are returned in an array. NOTE: duplicates are NOT removed from the return array
public split_message ( string $text ) : array
$text string Text to split, encoded in UTF-8
Результат array Array of UTF-8 words

tidy() публичный Метод

Tidy up indexes: Tag 'common words' and remove words no longer referenced in the match table
public tidy ( )

Описание свойств

$common_words защищенное свойство

Common words are words with length less/more than min/max length
protected array $common_words
Результат array

$config защищенное свойство

Config object
protected config,phpbb\config $config
Результат phpbb\config\config

$db защищенное свойство

Database connection
protected driver_interface,phpbb\db\driver $db
Результат phpbb\db\driver\driver_interface

$must_contain_ids защищенное свойство

Post ids of posts containing words that are to be included
protected array $must_contain_ids
Результат array

$must_exclude_one_ids защищенное свойство

Post ids of posts containing atleast one word that needs to be excluded
protected array $must_exclude_one_ids
Результат array

$must_not_contain_ids защищенное свойство

Post ids of posts containing words that should not be included
protected array $must_not_contain_ids
Результат array

$php_ext защищенное свойство

PHP Extension
protected string $php_ext
Результат string

$phpbb_root_path защищенное свойство

Relative path to board root
protected string $phpbb_root_path
Результат string

$search_query защищенное свойство

Operators are prefixed in search query and common words excluded
protected string $search_query
Результат string

$stats защищенное свойство

Associative array holding index stats
protected array $stats
Результат array

$user защищенное свойство

User object
protected user,phpbb $user
Результат phpbb\user

$word_length защищенное свойство

Associative array stores the min and max word length to be searched
protected array $word_length
Результат array