mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-22 10:57:56 +01:00
[feature/sphinx-fulltext-search] use Update in sphinx query
Instead of REPLACE use UPDATE since pgsql does not support REPLACE. A row is inserted at time of creating table so REPLACE is no longer needed. PHPBB3-10946
This commit is contained in:
parent
b81941a997
commit
81959927e5
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user