PHP Class phpbb\search\fulltext_native

Inheritance: extends phpbb\search\base
Afficher le fichier Open project: phpbb/phpbb

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
cleanup ( string $text, string $allowed_chars = null, string $encoding = 'utf-8' ) : string Clean up a text to remove non-alphanumeric characters
get_stats ( )

Method Details

__construct() public méthode

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

acp() public méthode

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

cleanup() protected méthode

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
Résultat string Cleaned up text, only alphanumeric chars are left

delete_index() public méthode

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

get_common_words() public méthode

Returns the common_words array
public get_common_words ( ) : array
Résultat array common words that are ignored by search backend

get_name() public méthode

Returns the name of this search backend to be displayed to administrators
public get_name ( ) : string
Résultat string Name

get_search_query() public méthode

Returns the search_query
public get_search_query ( ) : string
Résultat string search query

get_stats() protected méthode

protected get_stats ( )

get_word_length() public méthode

Returns the word_length array
public get_word_length ( ) : array
Résultat array min and max word length for searching

index() public méthode

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() public méthode

Returns true if both FULLTEXT indexes exist
public index_created ( )

index_remove() public méthode

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

index_stats() public méthode

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

split_keywords() public méthode

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)
Résultat boolean false if no valid keywords were found and otherwise true

split_message() public méthode

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
Résultat array Array of UTF-8 words

tidy() public méthode

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

Property Details

$common_words protected_oe property

Common words are words with length less/more than min/max length
protected array $common_words
Résultat array

$config protected_oe property

Config object
protected config,phpbb\config $config
Résultat phpbb\config\config

$db protected_oe property

Database connection
protected driver_interface,phpbb\db\driver $db
Résultat phpbb\db\driver\driver_interface

$must_contain_ids protected_oe property

Post ids of posts containing words that are to be included
protected array $must_contain_ids
Résultat array

$must_exclude_one_ids protected_oe property

Post ids of posts containing atleast one word that needs to be excluded
protected array $must_exclude_one_ids
Résultat array

$must_not_contain_ids protected_oe property

Post ids of posts containing words that should not be included
protected array $must_not_contain_ids
Résultat array

$php_ext protected_oe property

PHP Extension
protected string $php_ext
Résultat string

$phpbb_root_path protected_oe property

Relative path to board root
protected string $phpbb_root_path
Résultat string

$search_query protected_oe property

Operators are prefixed in search query and common words excluded
protected string $search_query
Résultat string

$stats protected_oe property

Associative array holding index stats
protected array $stats
Résultat array

$user protected_oe property

User object
protected user,phpbb $user
Résultat phpbb\user

$word_length protected_oe property

Associative array stores the min and max word length to be searched
protected array $word_length
Résultat array