From 01eebd6511ec5a381422a707387355aab6d87fa8 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 18 Aug 2012 00:26:36 +0530 Subject: [ticket/11177] return no results when query has only negation If search query has only -foo then instead of displaying all results that do not have foo, should display no results found. PHPBB3-11177 --- phpBB/includes/search/fulltext_postgres.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'phpBB/includes/search/fulltext_postgres.php') diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index 38989a9d9a..dc8b9e3a15 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -281,6 +281,12 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base return false; } + // When search query contains queries like -foo + if (strpos($this->search_query, '+') === false) + { + return false; + } + // generate a search_key from all the options to identify the results $search_key = md5(implode('#', array( implode(', ', $this->split_words), -- cgit v1.2.1 From 26a9ccab59ca1e1463778b169911a024acbd4736 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Fri, 10 Aug 2012 16:00:51 +0530 Subject: [ticket/11050] add access specifiers to pgsql search properties PHPBB3-11050 --- phpBB/includes/search/fulltext_postgres.php | 64 +++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/search/fulltext_postgres.php') diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index 38989a9d9a..ab4864bacc 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -22,18 +22,76 @@ if (!defined('IN_PHPBB')) */ class phpbb_search_fulltext_postgres extends phpbb_search_base { + /** + * Associative array holding index stats + * @var array + */ protected $stats = array(); + + /** + * Holds the words entered by user splitted in array + * @var array + */ protected $split_words = array(); + + /** + * True if postgresql version supports tsearch + * @var boolean + */ protected $tsearch_usable = false; + + /** + * Stores the PostgreSQL version + * @var string + */ protected $version; + + /** + * Stores the tsearch query + * @var string + */ protected $tsearch_query; + + /** + * True if phrase search is supported. + * postgreSQL fulltext currently doesn't support it + * @var boolean + */ protected $phrase_search = false; + + /** + * @var phpbb_config Config class object + */ protected $config; + + /** + * @var dbal DBAL class object + */ protected $db; + + /** + * @var user User class object + */ protected $user; - protected $search_query; - protected $common_words = array(); - protected $word_length = array(); + + /** + * Contains tidied search query + * @var string + */ + public $search_query; + + /** + * Contains common words + * common words are words with length less/more than min/max length + * @var array + */ + public $common_words = array(); + + /** + * Associative array stores the min and max length + * @var array + */ + public $word_length = array(); /** * Constructor -- cgit v1.2.1 From 3dc42c67d3d0870e47ecf98abfa885262bcf962d Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 14 Aug 2012 23:54:46 +0530 Subject: [ticket/11050] fix docblocks with description before @var PHPBB3-11050 --- phpBB/includes/search/fulltext_postgres.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/search/fulltext_postgres.php') diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index ab4864bacc..a41307a3a4 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -60,17 +60,20 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base protected $phrase_search = false; /** - * @var phpbb_config Config class object + * Config class object + * @var phpbb_config */ protected $config; /** - * @var dbal DBAL class object + * DBAL class object + * @var dbal */ protected $db; /** - * @var user User class object + * User class object + * @var user */ protected $user; -- cgit v1.2.1 From 56395ea3597ee7a487444ebd6e6d6c237a5a328a Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 15 Aug 2012 23:49:51 +0530 Subject: [ticket/11050] fix minor comment/docblocks issues No comments should end with a period. All occurences like PostgreSQL should have proper case. PHPBB3-11050 --- phpBB/includes/search/fulltext_postgres.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'phpBB/includes/search/fulltext_postgres.php') diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index a41307a3a4..6d6e6851c8 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -35,7 +35,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base protected $split_words = array(); /** - * True if postgresql version supports tsearch + * True if PostgreSQL version supports tsearch * @var boolean */ protected $tsearch_usable = false; @@ -53,8 +53,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base protected $tsearch_query; /** - * True if phrase search is supported. - * postgreSQL fulltext currently doesn't support it + * True if phrase search is supported + * PostgreSQL fulltext currently doesn't support it * @var boolean */ protected $phrase_search = false; @@ -98,7 +98,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base /** * Constructor - * Creates a new phpbb_search_fulltext_postgres, which is used as a search backend. + * 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 */ @@ -315,7 +315,7 @@ class phpbb_search_fulltext_postgres 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) @@ -336,7 +336,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base */ public function keyword_search($type, $fields, $terms, $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 keywords? No posts. + // No keywords? No posts if (!$this->search_query) { return false; @@ -520,7 +520,7 @@ class phpbb_search_fulltext_postgres 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; @@ -663,7 +663,7 @@ class phpbb_search_fulltext_postgres 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 -- cgit v1.2.1 From 8eed3591a9019cf8a377b7690130c1d466aa3ea2 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 16 Aug 2012 00:07:11 +0530 Subject: [ticket/11050] replace user by phpbb_user PHPBB3-11050 --- phpBB/includes/search/fulltext_postgres.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/search/fulltext_postgres.php') diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index 6d6e6851c8..cba281777f 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -73,7 +73,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base /** * User class object - * @var user + * @var phpbb_user */ protected $user; -- cgit v1.2.1 From b7dae379d53a81a1197e703aced19a6206985054 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sun, 19 Aug 2012 12:07:06 +0530 Subject: [ticket/11050] remove class word from docblocks PHPBB3-11050 --- phpBB/includes/search/fulltext_postgres.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/search/fulltext_postgres.php') diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index cba281777f..414b75f0f1 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -60,19 +60,19 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base protected $phrase_search = false; /** - * Config class object + * Config object * @var phpbb_config */ protected $config; /** - * DBAL class object + * DBAL object * @var dbal */ protected $db; /** - * User class object + * User object * @var phpbb_user */ protected $user; -- cgit v1.2.1 From 6ae64f1c1e37ff2b4de488d6f5264e581b0ac6cf Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sun, 19 Aug 2012 13:04:34 +0530 Subject: [ticket/11050] fix split words doc block language PHPBB3-11050 --- phpBB/includes/search/fulltext_postgres.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/search/fulltext_postgres.php') diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index 414b75f0f1..7863d070d4 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -29,7 +29,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base protected $stats = array(); /** - * Holds the words entered by user splitted in array + * Holds the words entered by user, obtained by splitting the entered query on whitespace * @var array */ protected $split_words = array(); -- cgit v1.2.1 From 7c3cbc07cf708865a8ab45547e5a8e70bb82196d Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sun, 19 Aug 2012 13:13:03 +0530 Subject: [ticket/11050] multi sentences separated by period in docblocks Starting of each sentence should be capitalized. PHPBB3-11050 --- phpBB/includes/search/fulltext_postgres.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/search/fulltext_postgres.php') diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index 7863d070d4..205a053451 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -53,7 +53,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base protected $tsearch_query; /** - * True if phrase search is supported + * True if phrase search is supported. * PostgreSQL fulltext currently doesn't support it * @var boolean */ @@ -84,8 +84,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base public $search_query; /** - * Contains common words - * common words are words with length less/more than min/max length + * Contains common words. + * Common words are words with length less/more than min/max length * @var array */ public $common_words = array(); -- cgit v1.2.1 From 0556959a6af3868fe17093840a46340105483759 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 20 Aug 2012 00:58:41 +0530 Subject: [ticket/11050] fix min/max length docblock language PHPBB3-11050 --- phpBB/includes/search/fulltext_postgres.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/search/fulltext_postgres.php') diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index 205a053451..50546edec3 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -91,7 +91,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base public $common_words = array(); /** - * Associative array stores the min and max length + * Associative array stores the min and max word length to be searched * @var array */ public $word_length = array(); -- cgit v1.2.1 From 72245e41d0df20ec30967d12836170a07bf5b427 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 20 Aug 2012 01:04:43 +0530 Subject: [ticket/11050] fix tidied search query docblock language PHPBB3-11050 --- phpBB/includes/search/fulltext_postgres.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/search/fulltext_postgres.php') diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index 50546edec3..98bf010c93 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -78,7 +78,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base protected $user; /** - * Contains tidied search query + * Contains tidied search query. + * Operators are prefixed in search query and common words excluded * @var string */ public $search_query; -- cgit v1.2.1 From a509a8ed2d921d4797e08531e70ba70afb167d9d Mon Sep 17 00:00:00 2001 From: Dhruv Date: Fri, 9 Nov 2012 16:22:32 +0530 Subject: [ticket/11050] make all properties protected in all search backends PHPBB-11050 --- phpBB/includes/search/fulltext_postgres.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/search/fulltext_postgres.php') diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index 98bf010c93..12a1203249 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -82,20 +82,20 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base * Operators are prefixed in search query and common words excluded * @var string */ - public $search_query; + protected $search_query; /** * Contains common words. * Common words are words with length less/more than min/max length * @var array */ - public $common_words = array(); + protected $common_words = array(); /** * Associative array stores the min and max word length to be searched * @var array */ - public $word_length = array(); + protected $word_length = array(); /** * Constructor -- cgit v1.2.1 From f5b3adb29653ed215de182962917501a1e36a020 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 10 Nov 2012 00:30:46 +0100 Subject: [ticket/10780] Use L_COLON on search backend ACP pages. PHPBB3-10780 --- phpBB/includes/search/fulltext_postgres.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/search/fulltext_postgres.php') diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index 34a27f294c..08f64735b6 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -884,11 +884,11 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base $tpl .= '
-

' . $this->user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN_EXPLAIN'] . '
+

' . $this->user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN_EXPLAIN'] . '
-

' . $this->user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN_EXPLAIN'] . '
+

' . $this->user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN_EXPLAIN'] . '
'; -- cgit v1.2.1