Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 Improving Full-Text Search speed?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

SiSL
Average Member

Turkey
671 Posts

Posted - 21 December 2007 :  10:32:48  Show Profile  Visit SiSL's Homepage
Full-text search speed seemed dramatically reduced when you throw in another table in to SQL statement.

Here you go:


SELECT DISTINCT t.TOPIC_ID, t.T_SUBJECT + '(' + CAST(m.M_NAME AS nvarchar(50)) + ')', c.CAT_NAME + ' \ ' + f.F_SUBJECT + ': ' + CAST(t.T_MESSAGE AS nvarchar(100)), T.T_DATE, '/forum/' + t.T_URLBASLIK + '_t' + CAST(t.TOPIC_ID AS nvarchar(10)) + '.html' AS  topic_url, 'Forum' "
	vidSQL = "FROM FORUM_TOPICS t, FORUM_REPLY r, FORUM_MEMBERS m, FORUM_FORUM f, FORUM_CATEGORY c, FORUM_MEMBERS mr " 
	vidSQL = vidSQL & " WHERE r.TOPIC_ID = t.TOPIC_ID AND m.MEMBER_ID = t.T_AUTHOR AND mr.MEMBER_ID = r.R_AUTHOR AND f.FORUM_ID = t.FORUM_ID AND c.CAT_ID=t.CAT_ID AND f.F_PRIVATEFORUMS = 0 AND  ("
	vidSQL = vidSQL & " CONTAINS(t.T_SUBJECT, '" & strFT & "') "
	vidSQL = vidSQL & " OR CONTAINS(t.T_MESSAGE, '" & strFT & "') "
	vidSQL = vidSQL & ")"



This is like a breeze 0,11 seconds...

But when you add:

	vidSQL = vidSQL & " OR CONTAINS(r.R_MESSAGE, '" & strFT & "')


It turns out 9,8 seconds...

Well, it is not just reply but also any other table, say like Members table including hinders it as much as it was..

So I used UNION, it fastened it a lot, like 0,5 seconds for entire replies and topics search. However, this time, I can't take total results by changing select lines "SELECT COUNT( DISTINCT (t.TOPIC_ID))"

I will have to also combine those results with some other tables. I wonder how I can do it without interfering...

So only way I can take to make it search every page, by getting entire row numbers and calculate number of pages by ASP and make it research again?

CHIP Online Forum

My Mods
Select All Code | Fix a vulnerability for your private messages | Avatar Categories W/ Avatar Gallery Mod | Complaint Manager
Admin Level Revisited | Merge Forums | No More Nested Quotes Mod

Edited by - SiSL on 21 December 2007 11:14:23

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 21 December 2007 :  11:19:29  Show Profile  Send ruirib a Yahoo! Message
You can always use a subquery like

SELECT COUNT (*) FROM
(
Here go your UNION queries....
)


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

SiSL
Average Member

Turkey
671 Posts

Posted - 21 December 2007 :  11:37:40  Show Profile  Visit SiSL's Homepage
Oh thank you :) can I hit my head on the wall for such easy solution that makes perfect sense? :)

CHIP Online Forum

My Mods
Select All Code | Fix a vulnerability for your private messages | Avatar Categories W/ Avatar Gallery Mod | Complaint Manager
Admin Level Revisited | Merge Forums | No More Nested Quotes Mod

Edited by - SiSL on 21 December 2007 11:38:26
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 21 December 2007 :  11:40:52  Show Profile  Send ruirib a Yahoo! Message
Sure you can... just don't hit too hard :).


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

bobby131313
Senior Member

USA
1163 Posts

Posted - 21 December 2007 :  12:04:50  Show Profile  Visit bobby131313's Homepage


The best part about it is.... it feels awesome when you stop.

Switch the order of your title tags
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 21 December 2007 :  17:40:52  Show Profile  Send pdrg a Yahoo! Message
Just a top tip, not sure if it's relevant here, but it may help someone sometime...

UNION will take time to dedupe your results, whereas UNION ALL just gives you the whole lot. If you know your result sets will be different, with no need to dedupe the resultset, use UNION ALL and save those extra clock cycles
Go to Top of Page

SiSL
Average Member

Turkey
671 Posts

Posted - 23 December 2007 :  11:17:38  Show Profile  Visit SiSL's Homepage
Aye, when doing full site search putting different indexes together, I used UNION ALL, however, giving out just results from Forum, I have to use, or entire search for same topic as replies come out as well :)

CHIP Online Forum

My Mods
Select All Code | Fix a vulnerability for your private messages | Avatar Categories W/ Avatar Gallery Mod | Complaint Manager
Admin Level Revisited | Merge Forums | No More Nested Quotes Mod
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.24 seconds. Powered By: Snitz Forums 2000 Version 3.4.07