From 6fbbb30a817a44fed1fb90ee35fca0d1caf83fcb Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 1 Aug 2012 22:18:12 +0530 Subject: [PATCH 1/2] [ticket/11032] add sphinx errors to error log PHPBB3-11032 --- phpBB/includes/search/fulltext_sphinx.php | 5 +++++ phpBB/language/en/acp/common.php | 1 + 2 files changed, 6 insertions(+) diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/includes/search/fulltext_sphinx.php index 8371f6b377..a2ebf1eb69 100644 --- a/phpBB/includes/search/fulltext_sphinx.php +++ b/phpBB/includes/search/fulltext_sphinx.php @@ -492,6 +492,11 @@ class phpbb_search_fulltext_sphinx $this->sphinx->SetLimits($start, (int) $per_page, SPHINX_MAX_MATCHES); $result = $this->sphinx->Query($search_query_prefix . str_replace('"', '"', $this->search_query), $this->indexes); + if ($this->sphinx->GetLastError()) + { + add_log('critical', 'LOG_SPHINX_ERROR', $this->sphinx->GetLastError()); + } + // Could be connection to localhost:9312 failed (errno=111, // msg=Connection refused) during rotate, retry if so $retries = SPHINX_CONNECT_RETRIES; diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 5cebcc89d7..04df897dba 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -690,6 +690,7 @@ $lang = array_merge($lang, array( 'LOG_SEARCH_INDEX_CREATED' => 'Created search index for
» %s', 'LOG_SEARCH_INDEX_REMOVED' => 'Removed search index for
» %s', + 'LOG_SPHINX_ERROR' => 'Sphinx Error
» %s', 'LOG_STYLE_ADD' => 'Added new style
» %s', 'LOG_STYLE_DELETE' => 'Deleted style
» %s', 'LOG_STYLE_EDIT_DETAILS' => 'Edited style
» %s', From 9358bf3de5fe402ccdc116e6b74e0cd2eee35e37 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 1 Aug 2012 22:23:51 +0530 Subject: [PATCH 2/2] [ticket/11032] use method GetLastError to get error Instead of using _error property, use method GetLastError to retrieve the error as sphinx API documentation states. PHPBB3-11032 --- phpBB/includes/search/fulltext_sphinx.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/includes/search/fulltext_sphinx.php index a2ebf1eb69..90ceb29616 100644 --- a/phpBB/includes/search/fulltext_sphinx.php +++ b/phpBB/includes/search/fulltext_sphinx.php @@ -500,7 +500,7 @@ class phpbb_search_fulltext_sphinx // Could be connection to localhost:9312 failed (errno=111, // msg=Connection refused) during rotate, retry if so $retries = SPHINX_CONNECT_RETRIES; - while (!$result && (strpos($this->sphinx->_error, "errno=111,") !== false) && $retries--) + while (!$result && (strpos($this->sphinx->GetLastError(), "errno=111,") !== false) && $retries--) { usleep(SPHINX_CONNECT_WAIT_TIME); $result = $this->sphinx->Query($search_query_prefix . str_replace('"', '"', $this->search_query), $this->indexes);