Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Beta Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Mysql 4 Search hack Details »»
Mysql 4 Search hack
Version: 1.00, by traekwon traekwon is offline
Developer Last Online: Apr 2006 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 04-16-2003 Last Update: Never Installs: 18
Is in Beta Stage  
No support by the author.

MySQL 4 Search hack for Vbulletin 2.x.x - version 1.2 beta
Author: PineappleClock (pineappleclock@clockcrew.cc) aim: Janitor61
-------------------------------------

Overview
The MySQL 4 search hack modifies the search functionality in Vbulletin to take advantage of the new SQL functions available in MySQL 4.

Synopsis
This hack allows MySQL to index the posts and threads in your BBS instead of requiring vbulletin to do it.
This hack, when installed, will change the BBS in the following ways:
  • Vbulletin will not require the 'word' or 'searchindex' tables anymore - saving lots of space - instead it will use the 'post' table as an index.
  • Vbulletin will not catalog, reference and index every word of every post upon insertion into the database - saving tons of processing.
  • No need to regenerate the search index ever.
  • The 'post' table will increase in size by about 35%
  • Searches will be considerably faster, and posting will be somewhat faster.
  • Search strings will be able to contain phrases, like "lets share a soda", which can include small words that would of been blocked in vbulletin 2.x searches.
  • Advanced searches, containing included words, optional words, excluded words and exact phrases.

File Listing
install.txt -- the installation howto
simplesearch.txt -- a block of code that replaces a block of code in search.php
searchtemplate.txt -- a vbulletin template used for drawing the search form.

Requirements
MySQL 4.0.1 or newer - required
vbulletin 2.x.x - required (i've only tested it on 2.3.0 though)

How to check your MySQL version:
execute the following query:
Code:
SELECT @@global.version

Notes
The installation instructions assumes that you have access to database management software, like phpMyAdmin. If you can't edit your database directly, I can make a php script that will modify your database if there's enough demand.

The Vbulletin team aren't going to put in support for MySQL 4 until version 3.1 - so this hack should be obsolete by then.
If you'd like to see the modified search engine, go here:

http://www.clockcrew.cc/bbs/search.php

I was originally going to distribute the whole modified search.php file, but after reading the rules, im only distributing the modified part. Please let me know if you spot any bugs, etc. I've tested this, but there still are probably bugs i need to work out.

update [Apr 17]: added instructions on uninstalling

good luck!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #62  
Old 05-27-2003, 01:35 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This hack bypasses vB and uses MySQL 4's own search abilities. It does seem to have sped up my site.
Reply With Quote
  #63  
Old 05-27-2003, 11:51 AM
David Bott David Bott is offline
 
Join Date: Dec 2001
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am sorry, but do you still have the limit statements in the code? If so, this is one the reason for your speed incrase. For you no longer search the entire database, but only up until X returns are found, then it stops. If you have them still in, remove them and see. MySQL has always been able to search, they have just improved it in ver 4 with the caching for the most part.

Not sure, but your database may not be large enough to see if their is a difference in speed. Not sure though. But just adding limit statments to our code, user selectable, made our site 100% faster all around due to the tables not locking as often on large returns.

Still looking for some real data and the author to return to support the hack. Even on his own site the phrase search does not seem to work.

Thanks
Reply With Quote
  #64  
Old 05-27-2003, 04:26 PM
Tigga's Avatar
Tigga Tigga is offline
 
Join Date: Dec 2001
Location: Atlanta
Posts: 1,061
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The phrase search works just fine for me. And I definitely notice a faster search time as well.
Reply With Quote
  #65  
Old 05-27-2003, 04:48 PM
David Bott David Bott is offline
 
Join Date: Dec 2001
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Question again...do you have the LIMIT statements still in the code? If I had to guess...I would say you do. For after teasting about 10 words on your site...all returned under 100 results. Thus I am guessing this is all why you see the search speed increase. Thanks
Reply With Quote
  #66  
Old 06-03-2003, 09:47 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is what I am getting when I do a search for the word "code":

Quote:
codebackground}; color:#EEEEFF; border:1px solid #273549" border="0" cellspacing="0" cellpadding="5"> ? Originally posted by Gandalf

testing <font color="red">html</font> for Gandalf
?
Does anyone know how to keep it from searching the PHP, Code and quotes boxes code?
Reply With Quote
  #67  
Old 06-03-2003, 10:42 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can someone please tell me how to "drop the two fulltext indexes" in the post table?

Edit: I am having major problems after un-installing this hack. I followed the directions exactly, but now when I search for words like color, background, code or font it highlights the words in my PHP, code and quote boxes code. It throws off the boxes and everything? Can someone please tell me what is happening and maybe how to fix it?

Edit again: NM, I figured it out.
Reply With Quote
  #68  
Old 06-04-2003, 08:26 PM
Tigga's Avatar
Tigga Tigga is offline
 
Join Date: Dec 2001
Location: Atlanta
Posts: 1,061
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're right David. I removed the LIMIT statements from 2 of the queries and it seems to work much better now.
Reply With Quote
  #69  
Old 06-04-2003, 08:48 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Which 2 queries? And I figured out a way to get rid of the plus sign before the word searched if anyone is interested.
Reply With Quote
  #70  
Old 06-04-2003, 08:58 PM
Tigga's Avatar
Tigga Tigga is offline
 
Join Date: Dec 2001
Location: Atlanta
Posts: 1,061
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you search for LIMIT 25 and LIMIT 100 those should be the correct 2.
Reply With Quote
  #71  
Old 06-04-2003, 09:05 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, I already took those 2 out. You said from 2 of the queries. I wanted to make sure I had the right 2. Thanks!

I finally got it working great! The highlight doesn't mess with the other stuff now. I had to redo the highlight statement, but that fixed it. Even on a small site, there is a major difference in the searching speed now.
Reply With Quote
  #72  
Old 06-04-2003, 09:47 PM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good work making the highlight work.
Reply With Quote
  #73  
Old 06-04-2003, 10:30 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you, sir. It was a blast figuring it out.
Reply With Quote
  #74  
Old 06-05-2003, 01:57 PM
gmarik's Avatar
gmarik gmarik is offline
 
Join Date: May 2002
Location: Mocsow
Posts: 1,288
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It is the best hack ever.
I was looking for it for half a year.
I even started a thread here about this on vb.com
Reply With Quote
  #75  
Old 06-06-2003, 06:37 PM
Da`Nacho Da`Nacho is offline
 
Join Date: Mar 2002
Location: Fort Worth, Texas
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
06-04-03 at 06:30 PM Boofo said this in Post #72
Thank you, sir. It was a blast figuring it out.

Care to provide instructions in this thread?
Reply With Quote
  #76  
Old 06-10-2003, 10:44 PM
traekwon traekwon is offline
 
Join Date: Mar 2002
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry i haven't been around lately, been trying to learn the whole .NET thing and clockcrew.cc is sort of a ghost town now :\

I believe that taking out the LIMITs on the search query would slow it down, but i haven't done any benchmarking.

here's what I did to fix the highlighting problem:

on line 626 (approx) of search.php you will find:

Code:
if ($search[querystring]!="") {
    $search[querystring]=urlencode($search[querystring]);
    $highlightwords="&highlight=$search[querystring]";
  } else {
    $highlightwords="";
  }
replace it with:

Code:
  if ($search[querystring]!="") {
    $search[querystring]=preg_replace("/ \-(.*) /"," ",$search[querystring]);
    $search[querystring]=preg_replace("/ \-(.*)$/","",$search[querystring]);
    $search[querystring]=str_replace("+","",$search[querystring]);
    $search[querystring]=str_replace('"',"",$search[querystring]);
    $search[querystring]=urlencode($search[querystring]);
    $highlightwords="&highlight=$search[querystring]";
  } else {
    $highlightwords="";
  }
i believe that would work, but the highlighting engine can't highlight phrases - I will get to work on fixing that, thats part of the underlying system not the search.php AFAIK


thanks for the kind words guys oh and gmarik, wheres the thread you started on vbulletin.com?
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 08:52 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05214 seconds
  • Memory Usage 2,366KB
  • Queries Executed 30 (?)
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
  • (3)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (16)post_thanks_box
  • (16)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (16)post_thanks_postbit_info
  • (15)postbit
  • (16)postbit_onlinestatus
  • (16)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete