SELECT data_key, data_value
FROM xf_data_registry
WHERE data_key IN ('options', 'languages', 'contentTypes', 'codeEventListeners', 'deferredRun', 'simpleCache', 'addOns', 'defaultStyleProperties', 'routeFiltersIn', 'routeFiltersOut', 'routesPublic', 'nodeTypes', 'bannedIps', 'discouragedIps', 'styles', 'displayStyles', 'userBanners', 'smilies', 'bbCode', 'threadPrefixes', 'userTitleLadder', 'reportCounts', 'moderationCounts', 'userModerationCounts', 'notices', 'userFieldsInfo')
Run Time: 0.000508
Select Type | Table | Type | Possible Keys | Key | Key Len | Ref | Rows | Extra |
---|
SIMPLE | xf_data_registry | range | PRIMARY | PRIMARY | 27 | | 26 | Using where |
SELECT data_key, data_value
FROM xf_data_registry
WHERE data_key IN ('brListenerClasses', 'brBriviumAddOns')
Run Time: 0.000196
Select Type | Table | Type | Possible Keys | Key | Key Len | Ref | Rows | Extra |
---|
SIMPLE | xf_data_registry | range | PRIMARY | PRIMARY | 27 | | 2 | Using where |
SELECT *
FROM xf_brivium_addon
ORDER BY addon_id
Run Time: 0.000167
Select Type | Table | Type | Possible Keys | Key | Key Len | Ref | Rows | Extra |
---|
SIMPLE | xf_brivium_addon | index | | PRIMARY | 77 | | 1 | |
INSERT INTO xf_data_registry
(data_key, data_value)
VALUES
(?, ?)
ON DUPLICATE KEY UPDATE
data_value = VALUES(data_value)
Params: brBriviumAddOns, a:0:{}
Run Time: 0.000122
SELECT cache_value
FROM xf_permission_combination
WHERE permission_combination_id = ?
Params: 1
Run Time: 0.000153
Select Type | Table | Type | Possible Keys | Key | Key Len | Ref | Rows | Extra |
---|
SIMPLE | xf_permission_combination | const | PRIMARY | PRIMARY | 4 | const | 1 | |
SELECT thread.*
,
user.gender, user.avatar_date, user.gravatar,
NULL AS thread_read_date,
0 AS thread_reply_banned,
0 AS thread_is_watched,
'' AS draft_message, NULL AS draft_extra
FROM xf_thread AS thread
LEFT JOIN xf_user AS user ON
(user.user_id = thread.user_id)
WHERE thread.thread_id = ?
Params: 177879
Run Time: 0.000359
Select Type | Table | Type | Possible Keys | Key | Key Len | Ref | Rows | Extra |
---|
SIMPLE | thread | const | PRIMARY | PRIMARY | 4 | const | 1 | |
SIMPLE | user | const | PRIMARY | PRIMARY | 4 | const | 1 | |
SELECT node.*, forum.*
,
permission.cache_value AS node_permission_cache,
NULL AS forum_read_date
FROM xf_forum AS forum
INNER JOIN xf_node AS node ON (node.node_id = forum.node_id)
LEFT JOIN xf_permission_cache_content AS permission
ON (permission.permission_combination_id = 1
AND permission.content_type = 'node'
AND permission.content_id = forum.node_id)
WHERE node.node_id = ?
Params: 9
Run Time: 0.000349
Select Type | Table | Type | Possible Keys | Key | Key Len | Ref | Rows | Extra |
---|
SIMPLE | forum | const | PRIMARY | PRIMARY | 4 | const | 1 | |
SIMPLE | node | const | PRIMARY | PRIMARY | 4 | const | 1 | |
SIMPLE | permission | const | PRIMARY | PRIMARY | 35 | const,const,const | 1 | |
SELECT post.*
,
thread.*, thread.user_id AS thread_user_id, thread.username AS thread_username,
thread.post_date AS thread_post_date,
post.user_id, post.username, post.post_date,
bb_code_parse_cache.parse_tree AS message_parsed, bb_code_parse_cache.cache_version AS message_cache_version,
user.*, IF(user.username IS NULL, post.username, user.username) AS username,
user_profile.*,
user_privacy.*,
signature_parse_cache.parse_tree AS signature_parsed, bb_code_parse_cache.cache_version AS signature_cache_version,
session_activity.view_date AS last_view_date,
0 AS like_date
FROM xf_post AS post
INNER JOIN xf_thread AS thread ON
(thread.thread_id = post.thread_id)
LEFT JOIN xf_bb_code_parse_cache AS bb_code_parse_cache ON
(bb_code_parse_cache.content_type = 'post' AND bb_code_parse_cache.content_id = post.post_id)
LEFT JOIN xf_user AS user ON
(user.user_id = post.user_id)
LEFT JOIN xf_user_profile AS user_profile ON
(user_profile.user_id = post.user_id)
LEFT JOIN xf_user_privacy AS user_privacy ON
(user_privacy.user_id = post.user_id)
LEFT JOIN xf_bb_code_parse_cache AS signature_parse_cache ON
(signature_parse_cache.content_type = 'signature' AND signature_parse_cache.content_id = post.user_id)
LEFT JOIN xf_session_activity AS session_activity ON
(post.user_id > 0 AND session_activity.user_id = post.user_id AND session_activity.unique_key = CAST(post.user_id AS BINARY))
WHERE (
(post.thread_id = ? AND (post.position >= 0 AND post.position < 10) )
)
AND (post.message_state IN ('visible'))
ORDER BY post.position ASC, post.post_date ASC
Params: 177879
Run Time: 0.002783
Select Type | Table | Type | Possible Keys | Key | Key Len | Ref | Rows | Extra |
---|
SIMPLE | thread | const | PRIMARY | PRIMARY | 4 | const | 1 | Using filesort |
SIMPLE | post | range | thread_id_post_date,thread_id_position | thread_id_position | 8 | | 3 | Using index condition; Using where |
SIMPLE | bb_code_parse_cache | eq_ref | content_type_id | content_type_id | 31 | const,xenforo.cc.post.post_id | 1 | Using where |
SIMPLE | user | eq_ref | PRIMARY | PRIMARY | 4 | xenforo.cc.post.user_id | 1 | |
SIMPLE | user_profile | eq_ref | PRIMARY | PRIMARY | 4 | xenforo.cc.post.user_id | 1 | |
SIMPLE | user_privacy | eq_ref | PRIMARY | PRIMARY | 4 | xenforo.cc.post.user_id | 1 | |
SIMPLE | signature_parse_cache | eq_ref | content_type_id | content_type_id | 31 | const,xenforo.cc.post.user_id | 1 | Using where |
SIMPLE | session_activity | eq_ref | PRIMARY | PRIMARY | 22 | xenforo.cc.post.user_id,func | 1 | Using where |
INSERT INTO xf_thread_view
(thread_id)
VALUES
(?)
Params: 177879
Run Time: 0.000086
INSERT INTO `xf_session` (`session_id`, `session_data`, `expiry_date`) VALUES (?, ?, ?)
Params: 02a713448eec19268132cc5b986df357, , 1714655345
Run Time: 0.000574
INSERT INTO xf_session_activity
(user_id, unique_key, ip, controller_name, controller_action, view_state, params, view_date, robot_key)
VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE
ip = VALUES(ip),
controller_name = VALUES(controller_name),
controller_action = VALUES(controller_action),
view_state = VALUES(view_state),
params = VALUES(params),
view_date = VALUES(view_date),
robot_key = VALUES(robot_key)
Params: 0, , , XenForo_ControllerPublic_Thread, Index, valid, thread_id=177879, 1714651745,
Run Time: 0.000103
INSERT INTO xf_bb_code_parse_cache
(content_type, content_id, parse_tree, cache_version, cache_date)
VALUES (?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE parse_tree = VALUES(parse_tree),
cache_version = VALUES(cache_version),
cache_date = VALUES(cache_date)
Params: post, 182682, a:3:{i:0;s:71:"PHP中文分词
最常见的词语二分法:
$str = '这是我的网站";i:1;a:4:{s:3:"tag";s:3:"url";s:6:"option";s:23:"http://www.7di.net!';";s:8:"original";a:2:{i:0;s:31:"[URL="http://www.7di.net!';"]";i:1;s:6:"[/URL]";}s:8:"children";a:1:{i:0;s:16:"www.7di.net!';";}}i:2;s:1908:"
//$str = iconv('GB2312','UTF-8',$str);
$result = spStr($str);
print_r($result);
/**
* UTF-8版 中文二元分词
*/
function spStr($str)
{
$cstr = array();
$search = array(",", "/", "\\", ".", ";", ":", "\"", "!", "~", "`", "^", "(", ")", "?", "-", "\t", "\n", "'", "<", ">", "\r", "\r\n", "{1}quot;", "&", "%", "#", "@", "+", "=", "{", "}", "[", "]", ":", ")", "(", ".", "。", ",", "!", ";", "“", "”", "‘", "’", "[", "]", "、", "—", " ", "《", "》", "-", "…", "【", "】",);
$str = str_replace($search, " ", $str);
preg_match_all("/[a-zA-Z]+/", $str, $estr);
preg_match_all("/[0-9]+/", $str, $nstr);
$str = preg_replace("/[0-9a-zA-Z]+/", " ", $str);
$str = preg_replace("/\s{2,}/", " ", $str);
$str = explode(" ", trim($str));
foreach ($str as $s) {
$l = strlen($s);
$bf = null;
for ($i= 0; $i< $l; $i=$i+3) {
$ns1 = $s{$i}.$s{$i+1}.$s{$i+2};
if (isset($s{$i+3})) {
$ns2 = $s{$i+3}.$s{$i+4}.$s{$i+5};
if (preg_match("/[\x80-\xff]{3}/",$ns2)) $cstr[] = $ns1.$ns2;
} else if ($i == 0) {
$cstr[] = $ns1;
}
}
}
$estr = isset($estr[0])?$estr[0]:array();
$nstr = isset($nstr[0])?$nstr[0]:array();
return array_merge($nstr,$estr,$cstr);
}
執行結果是:
Array ( [0] => 7 [1] => www [2] => di [3] => net [4] => 这是 [5] => 是我 [6] => 我的 [7] => 的网 [8] => 网站 )
接下来,将以上结果转换为区位码,PHP代码是:
foreach ($result as $s) {
$s = iconv('UTF-8','GB2312',$s);
$code[] = gbCode($s);
}
$code = implode(" ", $code);
echo $code;
function gbCode($str) {
$return = null;
if (!preg_match("/^[\x80-\xff]{2,}$/",$str)) return $str;
$len = strlen($str);
for ($i= 0; $i< $len; $i=$i+2) {
$return .= sprintf("%02d%02d",ord($str{$i})-160,ord($str{$i+1})-160);
}
return $return;
}";}, 1621686945, 1714651745
Run Time: 0.000793
INSERT INTO xf_bb_code_parse_cache
(content_type, content_id, parse_tree, cache_version, cache_date)
VALUES (?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE parse_tree = VALUES(parse_tree),
cache_version = VALUES(cache_version),
cache_date = VALUES(cache_date)
Params: post, 183939, a:2:{i:0;s:333:"mysql指定了最小字符长度,默认是4,必须要匹配大于4的才会有返回结果,可以用SHOW VARIABLES LIKE 'ft_min_word_len' 来查看指定的字符长度,也可以在mysql配置文件my.ini 更改最小字符长度,方法是在my.ini 增加一行 比如:ft_min_word_len = 2,改完后重启mysql即可。
";i:1;a:4:{s:3:"tag";s:3:"url";s:6:"option";N;s:8:"original";a:2:{i:0;s:5:"[URL]";i:1;s:6:"[/URL]";}s:8:"children";a:1:{i:0;s:64:"http://www.cnblogs.com/feichexia/archive/2012/06/09/2543049.html";}}}, 1621686945, 1714651745
Run Time: 0.000706