diff options
-rw-r--r-- | phpBB/docs/sphinx.sample.conf | 4 | ||||
-rw-r--r-- | phpBB/includes/search/fulltext_sphinx.php | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/phpBB/docs/sphinx.sample.conf b/phpBB/docs/sphinx.sample.conf index 3ab2552096..8ffd54a880 100644 --- a/phpBB/docs/sphinx.sample.conf +++ b/phpBB/docs/sphinx.sample.conf @@ -7,7 +7,7 @@ source source_phpbb_{SPHINX_ID}_main sql_db = db_name sql_port = 3306 #optional, default is 3306 sql_query_pre = SET NAMES 'utf8' - sql_query_pre = REPLACE INTO phpbb_sphinx SELECT 1, MAX(post_id) FROM phpbb_posts + sql_query_pre = UPDATE phpbb_sphinx SET max_doc_id = MAX(post_id) WHERE counter_id = 1 sql_query_range = SELECT MIN(post_id), MAX(post_id) FROM phpbb_posts sql_range_step = 5000 sql_query = SELECT
\ @@ -27,7 +27,7 @@ source source_phpbb_{SPHINX_ID}_main p.topic_id = t.topic_id
\ AND p.post_id >= $start AND p.post_id <= $end sql_query_post = - sql_query_post_index = REPLACE INTO phpbb_sphinx ( counter_id, max_doc_id ) VALUES ( 1, $maxid ) + sql_query_post_index = UPDATE phpbb_sphinx SET max_doc_id = $maxid WHERE counter_id = 1 sql_query_info = SELECT * FROM phpbb_posts WHERE post_id = $id sql_attr_uint = forum_id sql_attr_uint = topic_id diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/includes/search/fulltext_sphinx.php index f505703c09..d82a56c6f4 100644 --- a/phpBB/includes/search/fulltext_sphinx.php +++ b/phpBB/includes/search/fulltext_sphinx.php @@ -151,7 +151,7 @@ class phpbb_search_fulltext_sphinx array('sql_db', $dbname), array('sql_port', $dbport), array('sql_query_pre', 'SET NAMES \'utf8\''), - array('sql_query_pre', 'REPLACE INTO ' . SPHINX_TABLE . ' SELECT 1, MAX(post_id) FROM ' . POSTS_TABLE . ''), + array('sql_query_pre', 'UPDATE ' . SPHINX_TABLE . ' SET max_doc_id = (SELECT MAX(post_id) FROM ' . POSTS_TABLE . ') WHERE counter_id = 1'), array('sql_query_range', 'SELECT MIN(post_id), MAX(post_id) FROM ' . POSTS_TABLE . ''), array('sql_range_step', '5000'), array('sql_query', 'SELECT @@ -171,7 +171,7 @@ class phpbb_search_fulltext_sphinx p.topic_id = t.topic_id AND p.post_id >= $start AND p.post_id <= $end'), array('sql_query_post', ''), - array('sql_query_post_index', 'REPLACE INTO ' . SPHINX_TABLE . ' ( counter_id, max_doc_id ) VALUES ( 1, $maxid )'), + array('sql_query_post_index', 'UPDATE ' . SPHINX_TABLE . ' SET max_doc_id = $maxid WHERE counter_id = 1'), array('sql_query_info', 'SELECT * FROM ' . POSTS_TABLE . ' WHERE post_id = $id'), array('sql_attr_uint', 'forum_id'), array('sql_attr_uint', 'topic_id'), @@ -634,6 +634,13 @@ class phpbb_search_fulltext_sphinx $sql = 'TRUNCATE TABLE ' . SPHINX_TABLE; $this->db->sql_query($sql); + + $data = array( + 'counter_id' => '1', + 'max_doc_id' => '0', + ); + $sql = 'INSERT INTO ' . SPHINX_TABLE . ' ' . $this->db->sql_build_array('INSERT', $data); + $this->db->sql_query($sql); } return false; |