class fulltext_sphinx
Fulltext search based on the sphinx search deamon
Methods
__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 |
||
string |
get_name()
Returns the name of this search backend to be displayed to administrators |
|
string |
get_search_query()
Returns the search_query |
|
false |
get_word_length()
Returns false as there is no word_len array |
|
array |
get_common_words()
Returns an empty array as there are no common_words |
|
string|bool |
init()
Checks permissions and paths, if everything is correct it generates the config file |
|
false |
split_keywords(string $keywords, string $terms)
Splits keywords entered by a user into an array of words stored in $this->splitwords Stores the tidied search query in $this->searchquery |
|
string |
sphinx_clean_search_string(string $search_string)
Cleans search query passed into Sphinx search engine, as follows: 1. |
|
keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, $id_ary, $start, $per_page)
Performs a search on keywords depending on display specific params. |
||
author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, $id_ary, $start, $per_page)
Performs a search on an author's posts without caring about message contents. |
||
index($mode, $post_id, $message, $subject, $poster_id, $forum_id)
Updates wordlist and wordmatch tables when a message is posted or changed |
||
index_remove($post_ids, $author_ids, $forum_ids)
Delete a post from the index after it was deleted |
||
tidy($create = false)
Nothing needs to be destroyed |
||
string|bool |
create_index($acp_module, $u_action)
Create sphinx table |
|
string|bool |
delete_index($acp_module, $u_action)
Drop sphinx table |
|
bool |
index_created($allow_new_files = true)
Returns true if the sphinx table was created |
|
string|bool |
index_stats()
Returns an associative array containing information about the indexes |
|
associative |
acp()
Returns a list of options for the ACP to display |
Details
at line 136
public
__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
public string
get_name()
Returns the name of this search backend to be displayed to administrators
at line 185
public string
get_search_query()
Returns the search_query
at line 195
public false
get_word_length()
Returns false as there is no word_len array
at line 205
public array
get_common_words()
Returns an empty array as there are no common_words
at line 215
public string|bool
init()
Checks permissions and paths, if everything is correct it generates the config file
at line 436
public false
split_keywords(string $keywords, string $terms)
Splits keywords entered by a user into an array of words stored in $this->splitwords Stores the tidied search query in $this->searchquery
at line 497
public string
sphinx_clean_search_string(string $search_string)
Cleans search query passed into Sphinx search engine, as follows: 1.
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*") 2. Words with apostrophes are contracted eg "it's" becomes "its" 3. <, >, " and & are decoded from HTML entities. 4. 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". 5. 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
public
keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, $id_ary, $start, $per_page)
Performs a search on keywords depending on display specific params.
You have to run split_keywords() first
at line 801
public
author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, $id_ary, $start, $per_page)
Performs a search on an author's posts without caring about message contents.
Depends on display specific params
at line 821
public
index($mode, $post_id, $message, $subject, $poster_id, $forum_id)
Updates wordlist and wordmatch tables when a message is posted or changed
at line 887
public
index_remove($post_ids, $author_ids, $forum_ids)
Delete a post from the index after it was deleted
at line 901
public
tidy($create = false)
Nothing needs to be destroyed
at line 911
public string|bool
create_index($acp_module, $u_action)
Create sphinx table
at line 943
public string|bool
delete_index($acp_module, $u_action)
Drop sphinx table
at line 960
public bool
index_created($allow_new_files = true)
Returns true if the sphinx table was created
at line 977
public string|bool
index_stats()
Returns an associative array containing information about the indexes
at line 1019
public associative
acp()
Returns a list of options for the ACP to display