phpBB API Documentation
Class

phpbb\search\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
$match_synonym
$replace_synonym

Methods

search_backend($error)

from base
int obtain_ids(string $search_key, int $result_count, array $id_ary, int $start, int $per_page, string $sort_dir)

Retrieves cached search results

from base
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

from base
destroy_cache($words, $authors = false)

Removes old entries from the search results table and removes searches with keywords that contain a word in $words.

from base
__construct($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher)

Initialises the fulltext_native search backend with min/max word length

string get_name()

Returns the name of this search backend to be displayed to administrators

string get_search_query()

Returns the search_query

array get_common_words()

Returns the common_words array

array get_word_length()

Returns the word_length array

split_keywords($keywords, $terms)

This function fills $this->search_query with the cleaned user search query

keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, $id_ary, $start, $per_page)

Performs a search on keywords depending on display specific params.

author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, $id_ary, $start, $per_page)

Performs a search on an author's posts without caring about message contents.

split_message($text)

Split a text into words of a given length

index($mode, $post_id, $message, $subject, $poster_id, $forum_id)

Updates wordlist and wordmatch tables when a message is posted or changed

index_remove($post_ids, $author_ids, $forum_ids)

Removes entries from the wordmatch table for the specified post_ids

tidy()

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

delete_index($acp_module, $u_action)

Deletes all words from the index

index_created()

Returns true if both FULLTEXT indexes exist

index_stats()

Returns an associative array containing information about the indexes

acp()

Returns a list of options for the ACP to display

Details

in base at line 33
public search_backend($error)

Parameters

$error

in base at line 51
public int obtain_ids(string $search_key, int $result_count, array $id_ary, int $start, int $per_page, string $sort_dir)

Retrieves cached search results

Parameters

string $search_key an md5 string generated from all the passed search options to identify the results
int $result_count will contain the number of all results for the search (not only for the current page)
array $id_ary is filled with the ids belonging to the requested page that are stored in the cache
int $start indicates the first index of the page
int $per_page number of ids each page is supposed to contain
string $sort_dir is either a or d representing ASC and DESC

Return Value

int SEARCHRESULTNOTINCACHE or SEARCHRESULTINCACHE or SEARCHRESULT_INCOMPLETE

in base at line 132
public 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

Parameters

string $search_key an md5 string generated from all the passed search options to identify the results
string $keywords contains the keywords as entered by the user
array $author_ary an array of author ids, if the author should be ignored during the search the array is empty
int $result_count contains the number of all results for the search (not only for the current page)
array $id_ary contains a list of post or topic ids that shall be cached, the first element must have the absolute index $start in the result set.
int $start indicates the first index of the page
string $sort_dir is either a or d representing ASC and DESC

Return Value

null

in base at line 241
public destroy_cache($words, $authors = false)

Removes old entries from the search results table and removes searches with keywords that contain a word in $words.

Parameters

$words
$authors

at line 114
public __construct($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher)

Initialises the fulltext_native search backend with min/max word length

Parameters

$error
$phpbb_root_path
$phpEx
$auth
$config
$db
$user
$phpbb_dispatcher

at line 141
public string get_name()

Returns the name of this search backend to be displayed to administrators

Return Value

string Name

at line 151
public string get_search_query()

Returns the search_query

Return Value

string search query

at line 161
public array get_common_words()

Returns the common_words array

Return Value

array common words that are ignored by search backend

at line 171
public array get_word_length()

Returns the word_length array

Return Value

array min and max word length for searching

at line 191
public split_keywords($keywords, $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 $mustnotcontainids, $mustcontainids and $mustexcludeoneids which are later used by keyword_search()

Parameters

$keywords
$terms

Performs a search on keywords depending on display specific params.

You have to run split_keywords() first

Parameters

$type
$fields
$terms
$sort_by_sql
$sort_key
$sort_dir
$sort_days
$ex_fid_ary
$post_visibility
$topic_id
$author_ary
$author_name
$id_ary
$start
$per_page

Performs a search on an author's posts without caring about message contents.

Depends on display specific params

Parameters

$type
$firstpost_only
$sort_by_sql
$sort_key
$sort_dir
$sort_days
$ex_fid_ary
$post_visibility
$topic_id
$author_ary
$author_name
$id_ary
$start
$per_page

at line 1313
public split_message($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

Parameters

$text

at line 1387
public index($mode, $post_id, $message, $subject, $poster_id, $forum_id)

Updates wordlist and wordmatch tables when a message is posted or changed

Parameters

$mode
$post_id
$message
$subject
$poster_id
$forum_id

at line 1544
public index_remove($post_ids, $author_ids, $forum_ids)

Removes entries from the wordmatch table for the specified post_ids

Parameters

$post_ids
$author_ids
$forum_ids

at line 1602
public tidy()

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

at line 1665
public delete_index($acp_module, $u_action)

Deletes all words from the index

Parameters

$acp_module
$u_action

at line 1686
public index_created()

Returns true if both FULLTEXT indexes exist

at line 1699
public index_stats()

Returns an associative array containing information about the indexes

at line 1956
public acp()

Returns a list of options for the ACP to display