[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/search/ -> fulltext_sphinx.php (summary)

This file is part of the phpBB Forum Software package.

Copyright: (c) phpBB Limited
License: GNU General Public License, version 2 (GPL-2.0)
File Size: 1058 lines (38 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

fulltext_sphinx:: (20 methods):
  __construct()
  get_name()
  get_search_query()
  get_word_length()
  get_common_words()
  init()
  config_generate()
  split_keywords()
  sphinx_clean_search_string()
  keyword_search()
  author_search()
  index()
  index_remove()
  tidy()
  create_index()
  delete_index()
  index_created()
  index_stats()
  get_stats()
  acp()


Class: fulltext_sphinx  - X-Ref

Fulltext search based on the sphinx search daemon

__construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher)   X-Ref
Constructor
Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend

param: string|bool $error Any error that occurs is passed on through this reference variable otherwise false
param: string $phpbb_root_path Relative path to phpBB root
param: string $phpEx PHP file extension
param: \phpbb\auth\auth $auth Auth object
param: \phpbb\config\config $config Config object
param: \phpbb\db\driver\driver_interface $db Database object
param: \phpbb\user $user User object
param: \phpbb\event\dispatcher_interface    $phpbb_dispatcher    Event dispatcher object

get_name()   X-Ref
Returns the name of this search backend to be displayed to administrators

return: string Name

get_search_query()   X-Ref
Returns the search_query

return: string search query

get_word_length()   X-Ref
Returns false as there is no word_len array

return: false

get_common_words()   X-Ref
Returns an empty array as there are no common_words

return: array common words that are ignored by search backend

init()   X-Ref
Checks permissions and paths, if everything is correct it generates the config file

return: string|bool Language key of the error/incompatibility encountered, or false if successful

config_generate()   X-Ref
Generates content of sphinx.conf

return: bool True if sphinx.conf content is correctly generated, false otherwise

split_keywords(&$keywords, $terms)   X-Ref
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

param: string $keywords Contains the keyword as entered by the user
param: string $terms is either 'all' or 'any'
return: false if no valid keywords were found and otherwise true

sphinx_clean_search_string($search_string)   X-Ref
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.

param: string    $search_string
return: string

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)   X-Ref
Performs a search on keywords depending on display specific params. You have to run split_keywords() first

param: string        $type                contains either posts or topics depending on what should be searched for
param: string        $fields                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)
param: string        $terms                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)
param: array        $sort_by_sql        contains SQL code for the ORDER BY part of a query
param: string        $sort_key            is the key of $sort_by_sql for the selected sorting
param: string        $sort_dir            is either a or d representing ASC and DESC
param: string        $sort_days            specifies the maximum amount of days a post may be old
param: array        $ex_fid_ary            specifies an array of forum ids which should not be searched
param: string        $post_visibility    specifies which types of posts the user can view in which forums
param: int            $topic_id            is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
param: array        $author_ary            an array of author ids if the author should be ignored during the search the array is empty
param: string        $author_name        specifies the author match, when ANONYMOUS is also a search-match
param: array        &$id_ary            passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered
param: int            $start                indicates the first index of the page
param: int            $per_page            number of ids each page is supposed to contain
return: boolean|int                        total number of results

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)   X-Ref
Performs a search on an author's posts without caring about message contents. Depends on display specific params

param: string        $type                contains either posts or topics depending on what should be searched for
param: boolean        $firstpost_only        if true, only topic starting posts will be considered
param: array        $sort_by_sql        contains SQL code for the ORDER BY part of a query
param: string        $sort_key            is the key of $sort_by_sql for the selected sorting
param: string        $sort_dir            is either a or d representing ASC and DESC
param: string        $sort_days            specifies the maximum amount of days a post may be old
param: array        $ex_fid_ary            specifies an array of forum ids which should not be searched
param: string        $post_visibility    specifies which types of posts the user can view in which forums
param: int            $topic_id            is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
param: array        $author_ary            an array of author ids
param: string        $author_name        specifies the author match, when ANONYMOUS is also a search-match
param: array        &$id_ary            passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered
param: int            $start                indicates the first index of the page
param: int            $per_page            number of ids each page is supposed to contain
return: boolean|int                        total number of results

index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id)   X-Ref
Updates wordlist and wordmatch tables when a message is posted or changed

param: string    $mode    Contains the post mode: edit, post, reply, quote
param: int    $post_id    The id of the post which is modified/created
param: string    &$message    New or updated post content
param: string    &$subject    New or updated post subject
param: int    $poster_id    Post author's user id
param: int    $forum_id    The id of the forum in which the post is located

index_remove($post_ids, $author_ids, $forum_ids)   X-Ref
Delete a post from the index after it was deleted


tidy($create = false)   X-Ref
Nothing needs to be destroyed


create_index($acp_module, $u_action)   X-Ref
Create sphinx table

return: string|bool error string is returned incase of errors otherwise false

delete_index($acp_module, $u_action)   X-Ref
Drop sphinx table

return: string|bool error string is returned incase of errors otherwise false

index_created($allow_new_files = true)   X-Ref
Returns true if the sphinx table was created

return: bool true if sphinx table was created

index_stats()   X-Ref
Returns an associative array containing information about the indexes

return: string|bool Language string of error false otherwise

get_stats()   X-Ref
Collects stats that can be displayed on the index maintenance page


acp()   X-Ref
Returns a list of options for the ACP to display

return: associative array containing template and config variables



Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1