aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/search/fulltext_mysql.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-11-10 12:27:19 +0100
committerJoas Schilling <nickvergessen@gmx.de>2012-11-10 12:27:19 +0100
commit948bfcbe770bd8cb6f95a7a7c5cabb3ddfe27597 (patch)
tree0ab44e608fd8d269a2e8ae151b51d0dc450f8c13 /phpBB/includes/search/fulltext_mysql.php
parent03821ad2a2c8b3386f795a79e422c6b3ba7c60f1 (diff)
parent29fdad396d62398f9544ebcfe5ac19cdaad5b120 (diff)
downloadforums-948bfcbe770bd8cb6f95a7a7c5cabb3ddfe27597.tar
forums-948bfcbe770bd8cb6f95a7a7c5cabb3ddfe27597.tar.gz
forums-948bfcbe770bd8cb6f95a7a7c5cabb3ddfe27597.tar.bz2
forums-948bfcbe770bd8cb6f95a7a7c5cabb3ddfe27597.tar.xz
forums-948bfcbe770bd8cb6f95a7a7c5cabb3ddfe27597.zip
Merge remote-tracking branch 'remotes/phpbb/develop' into feature/softdelete-merge-develop
# By Oleg Pudeyev (45) and others # Via Oleg Pudeyev (42) and others * remotes/phpbb/develop: (289 commits) [ticket/10865] Use code tags for install/database_update.php. [ticket/10865] Should have been a slash. [ticket/10780] Use L_COLON on LDAP page. [ticket/10780] Use L_COLON on search backend ACP pages. [ticket/10780] Use L_COLON for "download all attachments". [ticket/10780] Use colon from language in ucp_pm_compose.php where possible. [ticket/10780] Replace colons in phpBB/adm/style/acp_ext_details.html. [ticket/10780] Replace colon usage in adm template output with {L_COLON} [ticket/10780] Replace colon usage in template output with {L_COLON} [ticket/11181] Bump PHP requirement to 5.3.3 (from 5.3.2) [develop-olympus] [ticket/11181] Bump PHP requirement to 5.3.3 (from 5.3.2) [ticket/10172] Show prosilver birthday list even if there are no birthdays. [ticket/11050] make all properties protected in all search backends [ticket/11050] get_common_words() returns empty array for sphinx [ticket/11050] fix tidied search query docblock language [ticket/11050] fix min/max length docblock language [ticket/11050] multi sentences separated by period in docblocks [ticket/11050] fix separated spelling in docblock [ticket/11050] fix split words doc block language [ticket/11050] remove class word from docblocks ... Conflicts: phpBB/install/database_update.php phpBB/install/schemas/mssql_schema.sql phpBB/language/en/acp/permissions_phpbb.php phpBB/styles/prosilver/template/posting_editor.html
Diffstat (limited to 'phpBB/includes/search/fulltext_mysql.php')
-rw-r--r--phpBB/includes/search/fulltext_mysql.php91
1 files changed, 81 insertions, 10 deletions
diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php
index 81fb82de93..9f7e8a2195 100644
--- a/phpBB/includes/search/fulltext_mysql.php
+++ b/phpBB/includes/search/fulltext_mysql.php
@@ -22,18 +22,59 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_search_fulltext_mysql extends phpbb_search_base
{
+ /**
+ * Associative array holding index stats
+ * @var array
+ */
protected $stats = array();
+
+ /**
+ * Holds the words entered by user, obtained by splitting the entered query on whitespace
+ * @var array
+ */
protected $split_words = array();
+
+ /**
+ * Config object
+ * @var phpbb_config
+ */
protected $config;
+
+ /**
+ * DBAL object
+ * @var dbal
+ */
protected $db;
+
+ /**
+ * User object
+ * @var phpbb_user
+ */
protected $user;
- public $word_length = array();
- public $search_query;
- public $common_words = array();
+
+ /**
+ * Associative array stores the min and max word length to be searched
+ * @var array
+ */
+ protected $word_length = array();
+
+ /**
+ * Contains tidied search query.
+ * Operators are prefixed in search query and common words excluded
+ * @var string
+ */
+ protected $search_query;
+
+ /**
+ * Contains common words.
+ * Common words are words with length less/more than min/max length
+ * @var array
+ */
+ protected $common_words = array();
/**
* Constructor
- * Creates a new phpbb_search_fulltext_mysql, which is used as a search backend.
+ * Creates a new phpbb_search_fulltext_mysql, which is used as a search backend
*
* @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false
*/
@@ -59,6 +100,36 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
}
/**
+ * Returns the search_query
+ *
+ * @return string search query
+ */
+ public function get_search_query()
+ {
+ return $this->search_query;
+ }
+
+ /**
+ * Returns the common_words array
+ *
+ * @return array common words that are ignored by search backend
+ */
+ public function get_common_words()
+ {
+ return $this->common_words;
+ }
+
+ /**
+ * Returns the word_length array
+ *
+ * @return array min and max word length for searching
+ */
+ public function get_word_length()
+ {
+ return $this->word_length;
+ }
+
+ /**
* Checks for correct MySQL version and stores min/max word length in the config
*
* @return string|bool Language key of the error/incompatiblity occured
@@ -255,7 +326,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
}
/**
- * Performs a search on keywords depending on display specific params. You have to run split_keywords() first.
+ * 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)
@@ -276,7 +347,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
*/
public function 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)
{
- // No keywords? No posts.
+ // No keywords? No posts
if (!$this->search_query)
{
return false;
@@ -443,7 +514,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
*/
public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, $start, $per_page)
{
- // No author? No posts.
+ // No author? No posts
if (!sizeof($author_ary))
{
return 0;
@@ -581,7 +652,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
}
/**
- * Destroys cached search results, that contained one of the new words in a post so the results won't be outdated.
+ * Destroys cached search results, that contained one of the new words in a post so the results won't be outdated
*
* @param string $mode contains the post mode: edit, post, reply, quote ...
* @param int $post_id contains the post id of the post to index
@@ -810,11 +881,11 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
{
$tpl = '
<dl>
- <dt><label>' . $this->user->lang['MIN_SEARCH_CHARS'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_MYSQL_MIN_SEARCH_CHARS_EXPLAIN'] . '</span></dt>
+ <dt><label>' . $this->user->lang['MIN_SEARCH_CHARS'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_MYSQL_MIN_SEARCH_CHARS_EXPLAIN'] . '</span></dt>
<dd>' . $this->config['fulltext_mysql_min_word_len'] . '</dd>
</dl>
<dl>
- <dt><label>' . $this->user->lang['MAX_SEARCH_CHARS'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_MYSQL_MAX_SEARCH_CHARS_EXPLAIN'] . '</span></dt>
+ <dt><label>' . $this->user->lang['MAX_SEARCH_CHARS'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_MYSQL_MAX_SEARCH_CHARS_EXPLAIN'] . '</span></dt>
<dd>' . $this->config['fulltext_mysql_max_word_len'] . '</dd>
</dl>
';