新浪开放平台QA系统报错,SQL奇长。

2013-04-12 09:53:22 +08:00
 baby
查询时候报错:

Question2Answer query failed:

SELECT qa_posts.postid, qa_posts.categoryid, qa_posts.type, LEFT(qa_posts.type, 1) AS basetype, INSTR(qa_posts.type, '_HIDDEN')>0 AS hidden, qa_posts.acount, qa_posts.selchildid, qa_posts.closedbyid, qa_posts.upvotes, qa_posts.downvotes, qa_posts.netvotes, qa_posts.views, qa_posts.hotness, qa_posts.flagcount, qa_posts.title, qa_posts.tags, UNIX_TIMESTAMP(qa_posts.created) AS created, qa_categories.title AS categoryname, qa_categories.backpath AS categorybackpath, qa_posts.userid, qa_posts.cookieid, INET_NTOA(qa_posts.createip) AS createip, qa_userpoints.points, qa_users.flags, qa_users.level, qa_users.email AS email, qa_users.handle AS handle, qa_users.avatarblobid, qa_users.avatarwidth, qa_users.avatarheight, score, matchparts FROM qa_posts LEFT JOIN qa_categories ON qa_categories.categoryid=qa_posts.categoryid LEFT JOIN qa_users ON qa_posts.userid=qa_users.userid LEFT JOIN qa_userpoints ON qa_posts.userid=qa_userpoints.userid JOIN (SELECT questionid, SUM(score)+2*(LOG(10000)*(qa_posts.hotness-(SELECT MIN(hotness) FROM qa_posts WHERE type='Q'))/((SELECT MAX(hotness) FROM qa_posts WHERE type='Q')-(SELECT MIN(hotness) FROM qa_posts WHERE type='Q')))+LOG(questionid)/1000000 AS score, GROUP_CONCAT(CONCAT_WS(':', matchposttype, matchpostid, ROUND(score,3))) AS matchparts FROM ((SELECT postid AS questionid, LOG(10000/titlecount) AS score, 'Q' AS matchposttype, postid AS matchpostid FROM qa_titlewords JOIN qa_words ON qa_titlewords.wordid=qa_words.wordid WHERE word IN ('接','入','者','在','开','发','数','据','营','销','电','商','应','用','时',',','请','选','择','创','建','专','业','版','应','用') AND titlecount<10000) UNION ALL (SELECT questionid, (1-1/(1+count))*LOG(10000/contentcount)*(CASE qa_contentwords.type WHEN 'Q' THEN 1.0 WHEN 'A' THEN 0.5 ELSE 0.25 END) AS score, qa_contentwords.type AS matchposttype, qa_contentwords.postid AS matchpostid FROM qa_contentwords JOIN qa_words ON qa_contentwords.wordid=qa_words.wordid WHERE word IN ('接','入','者','在','开','发','数','据','营','销','电','商','应','用','时',',','请','选','择','创','建','专','业','版','应','用') AND contentcount<10000)) x LEFT JOIN qa_posts ON qa_posts.postid=questionid GROUP BY questionid ORDER BY score DESC LIMIT 0,50) y ON qa_posts.postid=y.questionid
2641 次点击
所在节点    分享发现
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/65651

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX