Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-15-2002, 08:02 PM
David Bott David Bott is offline
 
Join Date: Dec 2001
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Search Limite

Hello...

Please help if you can. I run AVS Forum, a very large Vb Site. Currently we have over 1.5 million on-line posts and I am getting cruised by large search results.

What I am looking for is someone who can hack the search.php so it will only return say the 100 most recent threads that has a persons search request.

I ask this because some of these searches are returning results in the 20,000 range. The issue is it then locked the tables when it is making this large return. So my hope is by not returning so much...I can cut down on the lock time and help the site.

Thoughts?

Thank you for your time,

David Bott
AVS Forum Admin
http://www.avsforum.com
Reply With Quote
  #2  
Old 11-16-2002, 08:29 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

edit search.php, find:

PHP Code:
    $posts=$DB_site->query("SELECT postid,wordid FROM searchindex WHERE $andor $intitle"); 
Replace it as:

PHP Code:
    $posts=$DB_site->query("SELECT postid,wordid FROM searchindex WHERE $andor $intitle ORDER BY postid DESC LIMIT 100"); 
This should work for what you wanted to do.. However 1 reservation:
This will force vb to return only 100 (recent) posts for every search. But please notice that this is 100 posts not 100 threads. So if someone searches for "posts" and he will be displayed 100 results. But if he searches for "threads" (which is vb default as you know) he might be returned less than 100 results depending on how many threads have more than 1 posts with that keyword.

Say if you search "sport" and choose "show as threads" and if you have a recent thread with 450 posts and 300 of them include that keyword, search will return only 1 result which is this thread.

If you apply the hack, you'll see better what I mean..

I didnt check it, but I guess the hack applies only applies to "regular searchs".. Today's new post searches or member searches shouldnt be affected..
Reply With Quote
  #3  
Old 11-16-2002, 11:04 AM
David Bott David Bott is offline
 
Join Date: Dec 2001
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you so much for your time. I will give this a try right away!!!
Reply With Quote
  #4  
Old 11-16-2002, 11:16 AM
David Bott David Bott is offline
 
Join Date: Dec 2001
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok...Seems to work just like you had said. Seeing it returns the top "posts" I have now made the limit 500 for the system surely should have no problem with that number vs returning 19,000.

We will now see and THANK YOU!
Reply With Quote
  #5  
Old 11-16-2002, 11:23 AM
David Bott David Bott is offline
 
Join Date: Dec 2001
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi...Me again...Sorry...

I would like to see this maybe more developed down the road. What I mean is...where the default is say maybe 100 but the user may select to go further back in time thus setting their own return if needed. Even the default will help the server greatly in just saving large returns when not needed.

Just a thought...But I do greatly thank you again for your help.
Reply With Quote
  #6  
Old 11-16-2002, 05:03 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can edit your search template and put a HTML code like this:

PHP Code:
<select name="returnno">
<
option selected>100</option>
<
option>200</option>
<
option>300</option>
<
option>400</option>
<
option>unnamed1</option>
</
select
Then find:
PHP Code:
// ###################### Start getallforumsql ####################### 
And before that add:
PHP Code:
$search_default_number=(int)$HTTP_POST_VARS['returnno'];
if (
$search_default_number<=OR !$search_default_number)
{
$search_default_number=100;} 
Then in the hack above replace your return result number with $search_default_number like:
PHP Code:
$posts=$DB_site->query("SELECT postid,wordid FROM searchindex WHERE $andor $intitle ORDER BY postid DESC LIMIT $search_default_number"); 
Not tested but should work..

Enjoy
Reply With Quote
  #7  
Old 11-16-2002, 05:46 PM
David Bott David Bott is offline
 
Join Date: Dec 2001
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh WOW!!!!! THis will be wonderful! Will get it install and see how it goes! THANK YOU!!!
Reply With Quote
  #8  
Old 11-17-2002, 03:40 PM
David Bott David Bott is offline
 
Join Date: Dec 2001
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok...It all seems to work. But I have one problem.

What if I want them to be able to look though the entire database? I made one setting called ALL give it a value of 20000 and the server really does not seem to like that. I used that vaule for the test I was doing before returned 19,792 posts.

If I do the serach wihtout the hack...it returns a lot quicker with the 19,792 results then with it set at a LIMIT of 20000.

But let me tell you...this is GREATLY helped the server!!!!!

Pondering.
Reply With Quote
  #9  
Old 11-18-2002, 10:50 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

David it's not the "LIMIT" that causes the performance loss, it's the "ORDER BY postid" command. I had to insert it so that the result returned will be sorted from the recent to the old. However searchindex table has an index on wordid not postid column and it's very large so our SQL command puts a burden on the db. The solution is easy: just create a index on postid column too and you'll be fine..
Reply With Quote
  #10  
Old 11-22-2002, 03:55 PM
David Bott David Bott is offline
 
Join Date: Dec 2001
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi...We need to talk about the serach thing. It seems to be affecting results somehow. Do you use AIM or ICQ? If so...can you please be so kind to PM me contact info so we may be able to work on this live.

THANKS!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:51 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06214 seconds
  • Memory Usage 2,269KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete