phpBB API Documentation
Class

phpbb\search\fulltext_postgres

class fulltext_postgres extends base

Fulltext search for PostgreSQL

Properties

$ignore_words
$match_synonym
$replace_synonym

Methods

search_backend($error)

from base
get_ignore_words()

Retrieves a language dependend list of words that should be ignored by the search

from base
get_synonyms()

Stores a list of synonyms that should be replaced in $this->matchsynonym and $this->replacesynonym and caches them

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(string|bool $error, string $phpbb_root_path, string $phpEx, auth $auth, config $config, driver_interface $db, user $user, dispatcher_interface $phpbb_dispatcher)

Constructor Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend

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

bool supports_phrase_search()

Returns if phrase search is supported or not

string|bool init()

Checks for correct PostgreSQL version and stores min/max word length in the config

split_keywords($keywords, $terms)

Splits keywords entered by a user into an array of words stored in $this->splitwords Stores the tidied search query in $this->searchquery

split_message(string $text)

Turns text into an array of words

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.

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

Destroys cached search results, that contained one of the new words in a post so the results won't be outdated

index_remove($post_ids, $author_ids, $forum_ids)

Destroy cached results, that might be outdated after deleting a post

tidy()

Destroy old cache entries

string|bool create_index($acp_module, $u_action)

Create fulltext index

string|bool delete_index($acp_module, $u_action)

Drop fulltext index

index_created()

Returns true if both FULLTEXT indexes exist

index_stats()

Returns an associative array containing information about the indexes

associative acp()

Display various options that can be configured for the backend from the acp

Details

in base at line 33
public search_backend($error)

Parameters

$error

in base at line 42
public get_ignore_words()

Retrieves a language dependend list of words that should be ignored by the search

in base at line 64
public get_synonyms()

Stores a list of synonyms that should be replaced in $this->matchsynonym and $this->replacesynonym and caches them

in base at line 97
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 178
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 287
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 103
public __construct(string|bool $error, string $phpbb_root_path, string $phpEx, auth $auth, config $config, driver_interface $db, user $user, dispatcher_interface $phpbb_dispatcher)

Constructor Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend

Parameters

string|bool $error Any error that occurs is passed on through this reference variable otherwise false
string $phpbb_root_path Relative path to phpBB root
string $phpEx PHP file extension
auth $auth Auth object
config $config Config object
driver_interface $db Database object
user $user User object
dispatcher_interface $phpbb_dispatcher Event dispatcher object

at line 128
public string get_name()

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

Return Value

string Name

at line 138
public string get_search_query()

Returns the search_query

Return Value

string search query

at line 148
public array get_common_words()

Returns the common_words array

Return Value

array common words that are ignored by search backend

at line 158
public array get_word_length()

Returns the word_length array

Return Value

array min and max word length for searching

Returns if phrase search is supported or not

Return Value

bool

at line 178
public string|bool init()

Checks for correct PostgreSQL version and stores min/max word length in the config

Return Value

string|bool Language key of the error/incompatiblity occurred

at line 196
public split_keywords($keywords, $terms)

Splits keywords entered by a user into an array of words stored in $this->splitwords Stores the tidied search query in $this->searchquery

Parameters

$keywords
$terms

at line 287
public split_message(string $text)

Turns text into an array of words

Parameters

string $text contains post text/subject

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 884
public index($mode, $post_id, $message, $subject, $poster_id, $forum_id)

Destroys cached search results, that contained one of the new words in a post so the results won't be outdated

Parameters

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

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

Destroy cached results, that might be outdated after deleting a post

Parameters

$post_ids
$author_ids
$forum_ids

at line 912
public tidy()

Destroy old cache entries

at line 925
public string|bool create_index($acp_module, $u_action)

Create fulltext index

Parameters

$acp_module
$u_action

Return Value

string|bool error string is returned incase of errors otherwise false

at line 958
public string|bool delete_index($acp_module, $u_action)

Drop fulltext index

Parameters

$acp_module
$u_action

Return Value

string|bool error string is returned incase of errors otherwise false

at line 989
public index_created()

Returns true if both FULLTEXT indexes exist

at line 1002
public index_stats()

Returns an associative array containing information about the indexes

at line 1058
public associative acp()

Display various options that can be configured for the backend from the acp

Return Value

associative array containing template and config variables