Property | 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 |
Method | 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 |
Method | Description | |
---|---|---|
cleanup ( string $text, string $allowed_chars = null, string $encoding = 'utf-8' ) : string | Clean up a text to remove non-alphanumeric characters | |
get_stats ( ) |
public __construct ( &$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user ) |
public 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 | ||
$type | string | contains either posts or topics depending on what should be searched for |
$firstpost_only | boolean | if true, only topic starting posts will be considered |
$sort_by_sql | array | contains SQL code for the ORDER BY part of a query |
$sort_key | string | is the key of $sort_by_sql for the selected sorting |
$sort_dir | string | is either a or d representing ASC and DESC |
$sort_days | string | specifies the maximum amount of days a post may be old |
$ex_fid_ary | array | specifies an array of forum ids which should not be searched |
$post_visibility | string | specifies which types of posts the user can view in which forums |
$topic_id | integer | is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched |
$author_ary | array | an array of author ids |
$author_name | string | specifies the author match, when ANONYMOUS is also a search-match |
$start | integer | indicates the first index of the page |
$per_page | integer | number of ids each page is supposed to contain |
return | boolean | integer | total number of results |
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 |
return | string | Cleaned up text, only alphanumeric chars are left |
public delete_index ( $acp_module, $u_action ) |
public get_common_words ( ) : array | ||
return | array | common words that are ignored by search backend |
public get_search_query ( ) : string | ||
return | string | search query |
public get_word_length ( ) : array | ||
return | array | min and max word length for searching |
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 |
public index_remove ( $post_ids, $author_ids, $forum_ids ) |
public index_stats ( ) |
public 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 | ||
$type | string | contains either posts or topics depending on what should be searched for |
$fields | string | contains either titleonly (topic titles should be searched), msgonly (only message bodies should be searched), firstpost (only subject and body of the first post should be searched) or all (all post bodies and subjects should be searched) |
$terms | string | is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) |
$sort_by_sql | array | contains SQL code for the ORDER BY part of a query |
$sort_key | string | is the key of $sort_by_sql for the selected sorting |
$sort_dir | string | is either a or d representing ASC and DESC |
$sort_days | string | specifies the maximum amount of days a post may be old |
$ex_fid_ary | array | specifies an array of forum ids which should not be searched |
$post_visibility | string | specifies which types of posts the user can view in which forums |
$topic_id | integer | is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched |
$author_ary | array | an array of author ids if the author should be ignored during the search the array is empty |
$author_name | string | specifies the author match, when ANONYMOUS is also a search-match |
$start | integer | indicates the first index of the page |
$per_page | integer | number of ids each page is supposed to contain |
return | boolean | integer | total number of results |
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) |
return | boolean | false if no valid keywords were found and otherwise true |
public split_message ( string $text ) : array | ||
$text | string | Text to split, encoded in UTF-8 |
return | array | Array of UTF-8 words |
public tidy ( ) |
protected array $common_words | ||
return | array |
protected config,phpbb\config $config | ||
return | phpbb\config\config |
protected driver_interface,phpbb\db\driver $db | ||
return | phpbb\db\driver\driver_interface |
protected array $must_contain_ids | ||
return | array |
protected array $must_exclude_one_ids | ||
return | array |
protected array $must_not_contain_ids | ||
return | array |
protected string $phpbb_root_path | ||
return | string |
protected string $search_query | ||
return | string |
protected array $stats | ||
return | array |
protected array $word_length | ||
return | array |