PHP Class phpbb\search\fulltext_sphinx

Datei anzeigen Open project: phpbb/phpbb

Protected Properties

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

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

Protected Methods

Method Description
config_generate ( ) : boolean Generates content of sphinx.conf
get_stats ( ) Collects stats that can be displayed on the index maintenance page

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

Returns a list of options for the ACP to display
public acp ( ) : associative
return associative array containing template and config variables

config_generate() protected method

Generates content of sphinx.conf
protected config_generate ( ) : boolean
return boolean True if sphinx.conf content is correctly generated, false otherwise

create_index() public method

Create sphinx table
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 sphinx table
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 an empty array as there are no common_words
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

Collects stats that can be displayed on the index maintenance page
protected get_stats ( )

get_word_length() public method

Returns false as there is no word_len array
public get_word_length ( ) : false
return false

index() public method

Updates wordlist and wordmatch tables when a message is posted or changed
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

index_created() public method

Returns true if the sphinx table was created
public index_created ( $allow_new_files = true ) : boolean
return boolean true if sphinx table was created

index_remove() public method

Delete a post from the index after it was deleted
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 ( ) : string | boolean
return string | boolean Language string of error false otherwise

init() public method

Checks permissions and paths, if everything is correct it generates the config file
public init ( ) : string | boolean
return string | boolean Language key of the error/incompatiblity encountered, or false if successful

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

tidy() public method

Nothing needs to be destroyed
public tidy ( $create = false )

Property Details

$auth protected_oe property

Auth object
protected auth,phpbb\auth $auth
return phpbb\auth\auth

$config protected_oe property

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

$config_file_data protected_oe property

Stores the generated content of the sphinx config file
protected string $config_file_data
return string

$db protected_oe property

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

$db_tools protected_oe property

Database Tools object
protected tools_interface,phpbb\db\tools $db_tools
return phpbb\db\tools\tools_interface

$dbtype protected_oe property

Stores the database type if supported by sphinx
protected string $dbtype
return string

$id protected_oe property

Holds unique sphinx id
protected string $id
return string

$indexes protected_oe property

Stores the names of both main and delta sphinx indexes separated by a semicolon
protected string $indexes
return string

$php_ext protected_oe property

PHP Extension
protected string $php_ext
return string

$phpbb_root_path protected_oe property

Relative path to board root
protected string $phpbb_root_path
return string

$search_query protected_oe property

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

$sphinx protected_oe property

Sphinx searchd client object
protected SphinxClient $sphinx
return SphinxClient

$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

$user protected_oe property

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