fulltext_native
class fulltext_native extends base
phpBB's own db driven fulltext search, version 2
Constants
UTF8_HANGUL_FIRST |
|
UTF8_HANGUL_LAST |
|
UTF8_CJK_FIRST |
|
UTF8_CJK_LAST |
|
UTF8_CJK_B_FIRST |
|
UTF8_CJK_B_LAST |
|
Properties
$ignore_words | from base | ||
$match_synonym | from base | ||
$replace_synonym | from base | ||
protected array | $stats | Associative array holding index stats |
|
protected array | $word_length | Associative array stores the min and max word length to be searched |
|
protected string | $search_query | Contains tidied search query. |
|
protected array | $common_words | Contains common words. |
|
protected array | $must_contain_ids | Post ids of posts containing words that are to be included |
|
protected array | $must_not_contain_ids | Post ids of posts containing words that should not be included |
|
protected array | $must_exclude_one_ids | Post ids of posts containing at least one word that needs to be excluded |
|
protected string | $phpbb_root_path | Relative path to board root |
|
protected string | $php_ext | PHP Extension |
|
protected config | $config | Config object |
|
protected driver_interface | $db | Database connection |
|
protected dispatcher_interface | $phpbb_dispatcher | phpBB event dispatcher object |
|
protected user | $user | User object |
Methods
Retrieves cached search results
Caches post/topic ids
Removes old entries from the search results table and removes searches with keywords that contain a word in $words.
Initialises the fulltext_native search backend with min/max word length
Returns the name of this search backend to be displayed to administrators
Returns the search_query
Returns the common_words array
Returns the word_length array
This function fills $this->search_query with the cleaned user search query
Performs a search on keywords depending on display specific params. You have to run split_keywords() first
Performs a search on an author's posts without caring about message contents. Depends on display specific params
Split a text into words of a given length
Updates wordlist and wordmatch tables when a message is posted or changed
Removes entries from the wordmatch table for the specified post_ids
Tidy up indexes: Tag 'common words' and remove words no longer referenced in the match table
Deletes all words from the index
Returns true if both FULLTEXT indexes exist
Returns an associative array containing information about the indexes
No description
Clean up a text to remove non-alphanumeric characters
Returns a list of options for the ACP to display
Details
in
base at line 33
search_backend($error)
No description
in
base at line 51
int
obtain_ids(string $search_key, int $result_count, array $id_ary, int $start, int $per_page, string $sort_dir)
Retrieves cached search results
in
base at line 132
null
save_ids(string $search_key, string $keywords, array $author_ary, int $result_count, array $id_ary, int $start, string $sort_dir)
Caches post/topic ids
in
base at line 241
destroy_cache($words, $authors = false)
Removes old entries from the search results table and removes searches with keywords that contain a word in $words.
at line 120
__construct(bool|string $error, string $phpbb_root_path, string $phpEx, auth $auth, config $config, driver_interface $db, user $user, dispatcher_interface $phpbb_dispatcher)
Initialises the fulltext_native search backend with min/max word length
at line 147
string
get_name()
Returns the name of this search backend to be displayed to administrators
at line 157
string
get_search_query()
Returns the search_query
at line 167
array
get_common_words()
Returns the common_words array
at line 177
array
get_word_length()
Returns the word_length array
at line 197
bool
split_keywords(string $keywords, string $terms)
This function fills $this->search_query with the cleaned user search query
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()
at line 550
bool|int
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, int $topic_id, array $author_ary, string $author_name, array $id_ary, int $start, int $per_page)
Performs a search on keywords depending on display specific params. You have to run split_keywords() first
at line 1041
bool|int
author_search(string $type, bool $firstpost_only, array $sort_by_sql, string $sort_key, string $sort_dir, string $sort_days, array $ex_fid_ary, string $post_visibility, int $topic_id, array $author_ary, string $author_name, array $id_ary, int $start, int $per_page)
Performs a search on an author's posts without caring about message contents. Depends on display specific params
at line 1337
array
split_message(string $text)
Split a text into words of a given length
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
at line 1411
index(string $mode, int $post_id, string $message, string $subject, int $poster_id, int $forum_id)
Updates wordlist and wordmatch tables when a message is posted or changed
at line 1600
index_remove($post_ids, $author_ids, $forum_ids)
Removes entries from the wordmatch table for the specified post_ids
at line 1658
tidy()
Tidy up indexes: Tag 'common words' and remove words no longer referenced in the match table
at line 1721
delete_index($acp_module, $u_action)
Deletes all words from the index
at line 1765
index_created()
Returns true if both FULLTEXT indexes exist
at line 1778
index_stats()
Returns an associative array containing information about the indexes
at line 1790
protected
get_stats()
No description
at line 1809
protected string
cleanup(string $text, string $allowed_chars = null, string $encoding = 'utf-8')
Clean up a text to remove non-alphanumeric characters
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.
at line 2035
acp()
Returns a list of options for the ACP to display