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 | |
$phrase_search | boolean | PostgreSQL fulltext currently doesn't support it | |
$search_query | string | Operators are prefixed in search query and common words excluded | |
$split_words | array | Holds the words entered by user, obtained by splitting the entered query on whitespace | |
$stats | array | Associative array holding index stats | |
$tsearch_query | string | Stores the tsearch query | |
$user | phpbb\user | User object | |
$word_length | array | Associative array stores the min and max word length to be searched |
Method | Description | |
---|---|---|
__construct ( string | boolean &$error, string $phpbb_root_path, string $phpEx, phpbb\auth\auth $auth, phpbb\config\config $config, $db, phpbb\user $user ) | Constructor Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend | |
acp ( ) : associative | Display various options that can be configured for the backend from the acp | |
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 | |
create_index ( $acp_module, $u_action ) : string | boolean | Create fulltext index | |
delete_index ( $acp_module, $u_action ) : string | boolean | Drop fulltext 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, string &$message, string &$subject, integer $poster_id, integer $forum_id ) | Destroys cached search results, that contained one of the new words in a post so the results won't be outdated | |
index_created ( ) | Returns true if both FULLTEXT indexes exist | |
index_remove ( $post_ids, $author_ids, $forum_ids ) | Destroy cached results, that might be outdated after deleting a post | |
index_stats ( ) | Returns an associative array containing information about the indexes | |
init ( ) : string | boolean | Checks for correct PostgreSQL version and stores min/max word length in the config | |
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 ( &$keywords, string $terms ) : boolean | Splits keywords entered by a user into an array of words stored in $this->split_words Stores the tidied search query in $this->search_query | |
split_message ( string $text ) | Turns text into an array of words | |
supports_phrase_search ( ) : boolean | Returns if phrase search is supported or not | |
tidy ( ) | Destroy old cache entries |
Method | Description | |
---|---|---|
get_stats ( ) | Computes the stats and store them in the $this->stats associative array |
public __construct ( string | boolean &$error, string $phpbb_root_path, string $phpEx, phpbb\auth\auth $auth, phpbb\config\config $config, $db, phpbb\user $user ) | ||
$error | string | boolean | Any error that occurs is passed on through this reference variable otherwise false |
$phpbb_root_path | string | Relative path to phpBB root |
$phpEx | string | PHP file extension |
$auth | phpbb\auth\auth | Auth object |
$config | phpbb\config\config | Config object |
$user | phpbb\user | User object |
public acp ( ) : associative | ||
return | associative | array containing template and config variables |
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 |
public create_index ( $acp_module, $u_action ) : string | boolean | ||
return | string | boolean | error string is returned incase of errors otherwise false |
public delete_index ( $acp_module, $u_action ) : string | boolean | ||
return | string | boolean | error string is returned incase of errors otherwise false |
public get_common_words ( ) : array | ||
return | array | common words that are ignored by search backend |
public get_search_query ( ) : string | ||
return | string | search query |
protected get_stats ( ) |
public get_word_length ( ) : array | ||
return | array | min and max word length for searching |
public index ( string $mode, integer $post_id, string &$message, string &$subject, integer $poster_id, integer $forum_id ) | ||
$mode | string | contains the post mode: edit, post, reply, quote ... |
$post_id | integer | contains the post id of the post to index |
$message | string | contains the post text of the post |
$subject | string | contains the subject of the post to index |
$poster_id | integer | contains the user id of the poster |
$forum_id | integer | contains the forum id of parent forum of the post |
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 ( &$keywords, string $terms ) : boolean | ||
$terms | string | is either 'all' or 'any' |
return | boolean | false if no valid keywords were found and otherwise true |
public split_message ( string $text ) | ||
$text | string | contains post text/subject |
public supports_phrase_search ( ) : boolean | ||
return | boolean |
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 bool $phrase_search | ||
return | boolean |
protected string $search_query | ||
return | string |
protected array $split_words | ||
return | array |
protected array $stats | ||
return | array |
protected string $tsearch_query | ||
return | string |
protected array $word_length | ||
return | array |