From 70a0caee28559bd1bd52b4ecf9d7d33acd732fe2 Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Tue, 3 Jul 2012 03:54:01 +0530 Subject: [PATCH] [feature/postgresql-fulltext-search] supports_phrase_search function function to return the value of the the private property phrase_search PHPBB3-9730 --- phpBB/includes/search/fulltext_postgres.php | 14 +++++++++++++- phpBB/search.php | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index 79c8035438..84ce674564 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -27,10 +27,10 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base private $tsearch_usable = false; private $version; private $tsearch_query; + private $phrase_search = false; public $search_query; public $common_words = array(); public $word_length = array(); - public $phrase_search = false; /** * Constructor @@ -70,6 +70,18 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base return 'PostgreSQL Fulltext'; } + /** + * Returns if phrase search is supported or not + * + * @return bool + * + * @access public + */ + public function supports_phrase_search() + { + return $this->phrase_search; + } + /** * Checks for correct PostgreSQL version and stores min/max word length in the config * diff --git a/phpBB/search.php b/phpBB/search.php index c93dbdfd34..1123d7c5b9 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -598,9 +598,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) // Check if search backend supports phrase search or not $phrase_search_disabled = ''; - if (strpos(html_entity_decode($keywords), '"') !== false && isset($search->phrase_search)) + if (strpos(html_entity_decode($keywords), '"') !== false && method_exists($search, 'supports_phrase_search')) { - $phrase_search_disabled = $search->phrase_search ? false : true; + $phrase_search_disabled = $search->supports_phrase_search() ? false : true; } $template->assign_vars(array(