PHP Class phpbb\search\fulltext_postgres

Inheritance: extends phpbb\search\base
Datei anzeigen Open project: phpbb/phpbb

Protected Properties

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

Public Methods

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

Protected Methods

Method Description
get_stats ( ) Computes the stats and store them in the $this->stats associative array

Method Details

__construct() public method

Constructor Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend
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

acp() public method

Display various options that can be configured for the backend from the acp
public acp ( ) : associative
return associative array containing template and config variables

create_index() public method

Create fulltext index
public create_index ( $acp_module, $u_action ) : string | boolean
return string | boolean error string is returned incase of errors otherwise false

delete_index() public method

Drop fulltext index
public delete_index ( $acp_module, $u_action ) : string | boolean
return string | boolean error string is returned incase of errors otherwise false

get_common_words() public method

Returns the common_words array
public get_common_words ( ) : array
return array common words that are ignored by search backend

get_name() public method

Returns the name of this search backend to be displayed to administrators
public get_name ( ) : string
return string Name

get_search_query() public method

Returns the search_query
public get_search_query ( ) : string
return string search query

get_stats() protected method

Computes the stats and store them in the $this->stats associative array
protected get_stats ( )

get_word_length() public method

Returns the word_length array
public get_word_length ( ) : array
return array min and max word length for searching

index() public method

Destroys cached search results, that contained one of the new words in a post so the results won't be outdated
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

index_created() public method

Returns true if both FULLTEXT indexes exist
public index_created ( )

index_remove() public method

Destroy cached results, that might be outdated after deleting a post
public index_remove ( $post_ids, $author_ids, $forum_ids )

index_stats() public method

Returns an associative array containing information about the indexes
public index_stats ( )

init() public method

Checks for correct PostgreSQL version and stores min/max word length in the config
public init ( ) : string | boolean
return string | boolean Language key of the error/incompatiblity occurred

split_keywords() public method

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

split_message() public method

Turns text into an array of words
public split_message ( string $text )
$text string contains post text/subject

tidy() public method

Destroy old cache entries
public tidy ( )

Property Details

$common_words protected_oe property

Common words are words with length less/more than min/max length
protected array $common_words
return array

$config protected_oe property

Config object
protected config,phpbb\config $config
return phpbb\config\config

$db protected_oe property

Database connection
protected driver_interface,phpbb\db\driver $db
return phpbb\db\driver\driver_interface

$search_query protected_oe property

Operators are prefixed in search query and common words excluded
protected string $search_query
return string

$split_words protected_oe property

Holds the words entered by user, obtained by splitting the entered query on whitespace
protected array $split_words
return array

$stats protected_oe property

Associative array holding index stats
protected array $stats
return array

$tsearch_query protected_oe property

Stores the tsearch query
protected string $tsearch_query
return string

$user protected_oe property

User object
protected user,phpbb $user
return phpbb\user

$word_length protected_oe property

Associative array stores the min and max word length to be searched
protected array $word_length
return array