[]
Scream said:Since the dosearch.php script runs off of post variables you can't easily add debug=1 to the URL to get the full information on the query. So, try this. Open up dosearch.php and right after the calls to get_input() add this:
$debug=1;
Then run a search using the mod you're trying to create. You'll get a full EXPLAIN on the query which will help diagnose what rows the search is grabbing and if it's using any indexes, etc. [/]
Here is the culprit:
Query: SELECT t1.B_Number , t1.B_Main , t3.U_Username , t1.B_Subject , t1.B_Posted , t1.B_Board , t3.U_Color , t1.B_Reged , t1.B_Icon , t2.Bo_Title , t2.Bo_Read_Perm , t2.Bo_Cat , t1.B_Posterid , t1.B_Status , t1.B_AnonName , t1.B_Body FROM w3t_Posts AS t1 , w3t_Boards AS t2 , w3t_Users AS t3 LEFT JOIN w3t_Posts as t4 ON t1.B_Main = t4.B_Main AND t1.B_Number < t4.B_Number WHERE (t4.B_Main IS NULL) AND t1.B_Approved = 'yes' AND t1.B_Board = t2.Bo_Keyword AND t1.B_Posterid = t3.U_Number AND t1.B_Status <> 'M' AND t1.B_Board IN ('UBB1' , 'UBB2' , 'UBB4' , 'UBB5' , 'UBB6' , 'networking' , 'danews' , 'construction' , 'soho' , 'reviews' , 'security' , 'win2k' , 'unix' , 'test' , 'ports' , 'info' , 'mobile' , 'feedback' , 'photos' , 'unreg' , 'swap' , 'change' , 'help' , 'deals' , 'article' , 'software') AND ( (t1.B_Subject LIKE '%%' OR t1.B_Body LIKE '%%')) ORDER BY t1.B_Last_Post DESC LIMIT 26
table type possible_keys key key_len ref rows Extra
t2 ALL indx1 27 Using temporary; Using filesort
t1 ref w3t_Postsindex7,ID_ndx,board_topic_ndx w3t_Postsindex7 103 const,t2.Bo_Keyword 2086 where used
t3 eq_ref PRIMARY,indx3 PRIMARY 4 t1.B_PosterId 1
t4 ref PRIMARY,w3t_Postsindex2,w3t_Postsindex3 w3t_Postsindex3 4 t1.B_Main 7 where used; Not exists
Query took a total of 46.043 seconds.
Not sure how this post is gonna look -formatting may be ugly...
