Property | Type | Description | |
---|---|---|---|
$auth | phpbb\auth\auth | Auth object | |
$config | phpbb\config\config | Config object | |
$config_file_data | string | Stores the generated content of the sphinx config file | |
$db | phpbb\db\driver\driver_interface | Database connection | |
$db_tools | phpbb\db\tools\tools_interface | Database Tools object | |
$dbtype | string | Stores the database type if supported by sphinx | |
$id | string | Holds unique sphinx id | |
$indexes | string | Stores the names of both main and delta sphinx indexes separated by a semicolon | |
$php_ext | string | PHP Extension | |
$phpbb_root_path | string | Relative path to board root | |
$search_query | string | Operators are prefixed in search query and common words excluded | |
$sphinx | SphinxClient | Sphinx searchd client object | |
$split_words | array | Holds the words entered by user, obtained by splitting the entered query on whitespace | |
$stats | array | Associative array holding index stats | |
$user | phpbb\user | User object |
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 | Returns a list of options for the ACP to display | |
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 sphinx table | |
delete_index ( $acp_module, $u_action ) : string | boolean | Drop sphinx table | |
get_common_words ( ) : array | Returns an empty array as there are no common_words | |
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 ( ) : false | Returns false as there is no word_len array | |
index ( string $mode, integer $post_id, &$message, &$subject, integer $poster_id, integer $forum_id ) | Updates wordlist and wordmatch tables when a message is posted or changed | |
index_created ( $allow_new_files = true ) : boolean | Returns true if the sphinx table was created | |
index_remove ( $post_ids, $author_ids, $forum_ids ) | Delete a post from the index after it was deleted | |
index_stats ( ) : string | boolean | Returns an associative array containing information about the indexes | |
init ( ) : string | boolean | Checks permissions and paths, if everything is correct it generates the config file | |
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 ( string &$keywords, string $terms ) : false | 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 | |
tidy ( $create = false ) | Nothing needs to be destroyed |
Method | Description | |
---|---|---|
config_generate ( ) : boolean | Generates content of sphinx.conf | |
get_stats ( ) | Collects stats that can be displayed on the index maintenance page |
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 |
protected config_generate ( ) : boolean | ||
return | boolean | True if sphinx.conf content is correctly generated, false otherwise |
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 ( ) : false | ||
return | false |
public index ( string $mode, integer $post_id, &$message, &$subject, integer $poster_id, integer $forum_id ) | ||
$mode | string | Contains the post mode: edit, post, reply, quote |
$post_id | integer | The id of the post which is modified/created |
$poster_id | integer | Post author's user id |
$forum_id | integer | The id of the forum in which the post is located |
public index_created ( $allow_new_files = true ) : boolean | ||
return | boolean | true if sphinx table was created |
public index_remove ( $post_ids, $author_ids, $forum_ids ) |
public index_stats ( ) : string | boolean | ||
return | string | boolean | Language string of error false otherwise |
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 ( string &$keywords, string $terms ) : false | ||
$keywords | string | Contains the keyword as entered by the user |
$terms | string | is either 'all' or 'any' |
return | false | if no valid keywords were found and otherwise true |
protected config,phpbb\config $config | ||
return | phpbb\config\config |
protected string $config_file_data | ||
return | string |
protected driver_interface,phpbb\db\driver $db | ||
return | phpbb\db\driver\driver_interface |
protected tools_interface,phpbb\db\tools $db_tools | ||
return | phpbb\db\tools\tools_interface |
protected string $dbtype | ||
return | string |
protected string $indexes | ||
return | string |
protected string $phpbb_root_path | ||
return | string |
protected string $search_query | ||
return | string |
protected SphinxClient $sphinx | ||
return | SphinxClient |
protected array $split_words | ||
return | array |
protected array $stats | ||
return | array |