Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Beta Releases

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
  #32  
Old 04-22-2003, 03:16 AM
jbourke jbourke is offline
 
Join Date: Nov 2001
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The mysql docs state that anything 3 or less characters is not indexed.

Jim
Reply With Quote
  #33  
Old 04-22-2003, 05:06 PM
mute mute is offline
 
Join Date: Dec 2002
Location: Phoenixville, PA
Posts: 152
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well there you have it, thanks Jim!

/me rtfms
Reply With Quote
  #34  
Old 04-22-2003, 06:31 PM
jbourke jbourke is offline
 
Join Date: Nov 2001
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmm...this hack only returns the first few pages of results.

I'm going to have to revert to the old search engine if there isn't a way to fix this.

Jim
Reply With Quote
  #35  
Old 04-22-2003, 06:34 PM
jbourke jbourke is offline
 
Join Date: Nov 2001
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

These two lines:

PHP Code:
    $posts=$DB_site->query("SELECT postid FROM post WHERE MATCH(title) AGAINST ('$querywc' IN BOOLEAN MODE) ORDER BY dateline DESC LIMIT 25"); 
and

PHP Code:
    $posts=$DB_site->query("SELECT postid FROM post WHERE MATCH(pagetext) AGAINST ('$querywc' IN BOOLEAN MODE) ORDER BY dateline DESC LIMIT 100"); 
both have limit statements.

Is there a problem with taking these out?

I don't mind experimenting but I'm a bit nervous because I have a pretty large forum.

Jim
Reply With Quote
  #36  
Old 04-22-2003, 06:42 PM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Jim, increse them as you see fit, if you think you've gone to high revert them.
Reply With Quote
  #37  
Old 04-23-2003, 01:56 AM
Da`Nacho Da`Nacho is offline
 
Join Date: Mar 2002
Location: Fort Worth, Texas
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A few problems I am noticing, please someone verify with their setup:

When viewing a thread contained in search results the search terms are only hilighted on the first page of the thread.

When searching for a PHRASE and viewing a thread contained in those results, the search terms are not hilighted at all in the results and when you click to visit page 2 in the thread it reloads the first page and the &hilight part of the URL is empty.

I don't recall these things happening with the original search schema.
Reply With Quote
  #38  
Old 04-23-2003, 06:26 AM
Da`Nacho Da`Nacho is offline
 
Join Date: Mar 2002
Location: Fort Worth, Texas
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Gah it's driving me crazy... somehow spaces or something are being inserted in the query string, thats whats causing the screwups but I don't understand where it's coming from.

IE a normal one word search will end up having a + behind it... hard to explain.

If I remove the hack it's totally fine...

I got so frustrated that I totally reinstalled a clean copy of vBulletin 2.3.0 and reperformed the hack - same results.
Reply With Quote
  #39  
Old 04-23-2003, 10:31 PM
Tigga's Avatar
Tigga Tigga is offline
 
Join Date: Dec 2001
Location: Atlanta
Posts: 1,061
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just installed the hack and it seems to be working pretty good. Searches are much better, and posting does seem a little faster.

I can confirm Da`Nacho's problems though. It doesn't seem to highlight the words, and when you search for an exact phrase, the page numbers no longer work. It seems the link to page 2 (or any other) on showthread.php is somehow missing the "pagenumber=X" part of the url. After you search and go to the thread though, if you take out the "&highlight=xxxx" in the url and reload the page, it seems to work fine.
Other than that though it seems to work great.
Reply With Quote
  #40  
Old 04-23-2003, 10:36 PM
Da`Nacho Da`Nacho is offline
 
Join Date: Mar 2002
Location: Fort Worth, Texas
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 05:31 PM Tigga said this in Post #38
Just installed the hack and it seems to be working pretty good. Searches are much better, and posting does seem a little faster.

I can confirm Da`Nacho's problems though. It doesn't seem to highlight the words, and when you search for an exact phrase, the page numbers no longer work. It seems the link to page 2 (or any other) on showthread.php is somehow missing the "pagenumber=X" part of the url. After you search and go to the thread though, if you take out the "&highlight=xxxx" and reload the page, it seems to work fine.
Other than that though it seems to work great.

Yeah, I spent 5 hours last night redoing and redoing this hack and I just dont' know what the problem is. Anyone who wants to see what we mean can visit www.candidforums.com and use the search (it's enabled for guests).

We are running MySQL 4.0.12-0 and php 4.3.1 on Apache 1.3.27.

Anyone have any clues?
Reply With Quote
  #41  
Old 04-23-2003, 11:06 PM
Tigga's Avatar
Tigga Tigga is offline
 
Join Date: Dec 2001
Location: Atlanta
Posts: 1,061
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well I can tell you where the problem is coming from... After you perform a search, if you hold your mouse over the thread, you'll see it's linking to something like:
http://yoursite.com/forum/showthread.php?s=&threadid=x&highlight="what+you+searched+for"
The " marks in the url seem to be what's causing the problem. When you click on the thread it replaces the " marks with %2B in your browsers url. If you remove the %2B from the url then it seems to work as it should. Not sure how to fix it yet, but hopefully that gives traekwon a little more insight as to what the problem is.

I also just noticed another strange problem that seems to be coming from the %2B being in the url... After I performed the search and went to one of the threads, a smilie image there had border="0" alt=""> after the image. When I viewed the source there it has this for the html code...


<td bgcolor="#160056" colspan="2" align="left" valign="top"><p><font class="nf">he saw 'the ring'<br /><font color="red"></font>
<font color="red"></font><br /><font color="red"></font>
<font color="red"></font><img src="/forum/images/smilies/frown.gif"<font color="red"></font> border="0"<font color="red"></font> alt="<font color="red"></font>"><font color="red"></font></font></p></td>

Obviously it's trying to highlight quite a few things there that it shouldn't be.
Reply With Quote
Reply

Thread Tools

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 04:18 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.04524 seconds
  • Memory Usage 2,312KB
  • Queries Executed 25 (?)
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)bbcode_code
  • (2)bbcode_php
  • (1)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
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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