fulltext_sphinx
class fulltext_sphinx
Fulltext search based on the sphinx search daemon
Properties
protected array | $stats | Associative array holding index stats |
|
protected array | $split_words | Holds the words entered by user, obtained by splitting the entered query on whitespace |
|
protected string | $id | Holds unique sphinx id |
|
protected string | $indexes | Stores the names of both main and delta sphinx indexes separated by a semicolon |
|
protected SphinxClient | $sphinx | Sphinx searchd client object |
|
protected string | $phpbb_root_path | Relative path to board root |
|
protected string | $php_ext | PHP Extension |
|
protected auth | $auth | Auth object |
|
protected config | $config | Config object |
|
protected driver_interface | $db | Database connection |
|
protected tools_interface | $db_tools | Database Tools object |
|
protected string | $dbtype | Stores the database type if supported by sphinx |
|
protected dispatcher_interface | $phpbb_dispatcher | phpBB event dispatcher object |
|
protected user | $user | User object |
|
protected string | $config_file_data | Stores the generated content of the sphinx config file |
|
protected string | $search_query | Contains tidied search query. |
Methods
Constructor Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend
Returns the name of this search backend to be displayed to administrators
Returns the search_query
Returns false as there is no word_len array
Returns an empty array as there are no common_words
Checks permissions and paths, if everything is correct it generates the config file
Generates content of sphinx.conf
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
Cleans search query passed into Sphinx search engine, as follows:
- Hyphenated words are replaced with keyword search for either the exact phrase with spaces or as a single word without spaces eg search for "know-it-all" becomes ("know it all"|"knowitall*")
- Words with apostrophes are contracted eg "it's" becomes "its"
- <, >, " and & are decoded from HTML entities.
Performs a search on keywords depending on display specific params. You have to run split_keywords() first
Performs a search on an author's posts without caring about message contents. Depends on display specific params
Updates wordlist and wordmatch tables when a message is posted or changed
Delete a post from the index after it was deleted
Nothing needs to be destroyed
Create sphinx table
Drop sphinx table
Returns true if the sphinx table was created
Returns an associative array containing information about the indexes
Collects stats that can be displayed on the index maintenance page
Returns a list of options for the ACP to display
Details
at line 136
__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
at line 175
string
get_name()
Returns the name of this search backend to be displayed to administrators
at line 185
string
get_search_query()
Returns the search_query
at line 195
false
get_word_length()
Returns false as there is no word_len array
at line 205
array
get_common_words()
Returns an empty array as there are no common_words
at line 215
string|bool
init()
Checks permissions and paths, if everything is correct it generates the config file
at line 233
protected bool
config_generate()
Generates content of sphinx.conf
at line 436
false
split_keywords(string $keywords, string $terms)
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
at line 497
string
sphinx_clean_search_string(string $search_string)
Cleans search query passed into Sphinx search engine, as follows:
- Hyphenated words are replaced with keyword search for either the exact phrase with spaces or as a single word without spaces eg search for "know-it-all" becomes ("know it all"|"knowitall*")
- Words with apostrophes are contracted eg "it's" becomes "its"
- <, >, " and & are decoded from HTML entities.
- Following special characters used as search operators in Sphinx are preserved when used with correct syntax: (a) quorum matching: "the world is a wonderful place"/3 Finds 3 of the words within the phrase. Number must be between 1 and 9. (b) proximity search: "hello world"~10 Finds hello and world within 10 words of each other. Number can be between 1 and 99. (c) strict word order: aaa << bbb << ccc Finds "aaa" only where it appears before "bbb" and only where "bbb" appears before "ccc". (d) exact match operator: if lemmatizer or stemming enabled, search will find exact match only and ignore other grammatical forms of the same word stem. eg. raining =cats and =dogs will not return "raining cat and dog" eg. ="search this exact phrase" will not return "searched this exact phrase", "searching these exact phrases".
- Special characters /, ~, << and = not complying with the correct syntax and other reserved operators are escaped and searched literally. Special characters not explicitly listed in charset_table or blend_chars in sphinx.conf will not be indexed and keywords containing them will be ignored by Sphinx. By default, only $, %, & and @ characters are indexed and searchable. String transformation is in backend only and not visible to the end user nor reflected in the results page URL or keyword highlighting.
at line 543
bool|int
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, int $topic_id, array $author_ary, string $author_name, array $id_ary, int $start, int $per_page)
Performs a search on keywords depending on display specific params. You have to run split_keywords() first
at line 801
bool|int
author_search(string $type, bool $firstpost_only, array $sort_by_sql, string $sort_key, string $sort_dir, string $sort_days, array $ex_fid_ary, string $post_visibility, int $topic_id, array $author_ary, string $author_name, array $id_ary, int $start, int $per_page)
Performs a search on an author's posts without caring about message contents. Depends on display specific params
at line 821
index(string $mode, int $post_id, string $message, string $subject, int $poster_id, int $forum_id)
Updates wordlist and wordmatch tables when a message is posted or changed
at line 887
index_remove($post_ids, $author_ids, $forum_ids)
Delete a post from the index after it was deleted
at line 901
tidy($create = false)
Nothing needs to be destroyed
at line 911
string|bool
create_index($acp_module, $u_action)
Create sphinx table
at line 943
string|bool
delete_index($acp_module, $u_action)
Drop sphinx table
at line 960
bool
index_created($allow_new_files = true)
Returns true if the sphinx table was created
at line 977
string|bool
index_stats()
Returns an associative array containing information about the indexes
at line 994
protected
get_stats()
Collects stats that can be displayed on the index maintenance page
at line 1019
associative
acp()
Returns a list of options for the ACP to display