vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Fulltext boolean search v.2.2 for vB (https://vborg.vbsupport.ru/showthread.php?t=62282)

JohnWoo 03-07-2004 10:00 PM

Fulltext boolean search v.2.2 for vB
 
Hello all!

Moving here from beta forum
https://vborg.vbsupport.ru/showthread.php?t=62218

This hack makes nearly same for vB3 as
[vB 2.2.x] - Mysql 4 Search hack
https://vborg.vbsupport.ru/showthread.php?t=51716
for vB2 :)

You will need MySQL server v4.0.1 or better (but sometimes it may work on 3.23.xx). After installing you will be able to search with empty native vB index (word and postindex tables) and using modifiers.
Allowed modifiers + are ,-, * and "
All modifiers except * should be used only once for one word (in the beginning and without space).
* it should be used at the end of a word.
For example:
windows unix -> will find messages containing at least one these words.
+windows +unix -> will find messages with both this words.
windows* -> will find "windows", "windowss", "windowssauce" or "windowst".
*indows will NOT find "windows"
"some words" -> will find "some words of wisdom", but will not find "some extra words".
Search phrase length limitations replaced with results number limitation.
Value of old "Search Index Maximum Word Length" used to limit number of posts in the result returned by fulltext search (control panel/Message Searching Options)
Supposed that it must run faster then native vB search :)

History:
v.2.2 [5 Apr 2004]
- search words relevance (when sort by relevance) added at last :)
but little different then native vB (it may not work when searching with * modifiers)
- attempt to fix incompatibility with other hacks
=to upgrade replace code block #5 in search.php with latest one :)

v.2.1 [4 Apr 2004]
- Excluding from search forums with "Index New Posts in Search Engine" option set to "No"

v.2.0 [30 Mar 2004]
-"Similar Threads" now must start working :) (to move from 1.x to 2 just change one more script - functions_search.php)

v.1.9 [29 Mar 2004]
-checking if $query string is not empty before running fill text sql

v.1.8 [20 Mar 2004]
- line numbers and higlight code changed for VB3 Gold
- more tests and error explanations

v.1.7 [9 Mar 2004]
- MySQL error for administrators bug fixed
checking is $not_forumid string exixts before adding it to query

v.1.6 [9 Mar 2004]
- national letters bug fixed
preg_replace("~[^\w\"\-+\* ]~i", "", $query);
was replaced by
preg_replace("~[^\w\xC0-\xFF\"\-+\* ]~i", "", $query);

v.1.5 [8 Mar 2004]
- TABLE_PREFIX bug fixed
- slightly optimised SQL requests

v.1.4 [8 Mar 2004]
- delete_post_index function turned off
- more tests and error explanations

v.1.3 [7 Mar 2004]
- less code because of using native vB $postQueryLogic and $threadQueryLogic conditions
- more tests and error explanations

v.1.2 [7 Mar 2004]
- boolean mode can be turned off in AdminCP ("Allow Search Wild Cards" setting)
- "titles only" search fixed
- limiting number of matches retunned by fulltext search AFTER applying search conditions

v.1.1 [7 Mar 2004]
- HighLight support added

gmarik 03-08-2004 01:22 PM

This goes quick

MrNase 03-08-2004 04:16 PM

i'll give it a try ;)

SDB 03-09-2004 07:55 AM

Anyone have any idea how efficient this is going to be with a very large board... 3 million posts.

Does it require firstly to index all of the current posts? If so, can anyone estimate how long that is likely to take?

thanks in advance

JohnWoo 03-09-2004 08:34 AM

when you will say
ALTER TABLE post ADD FULLTEXT (title)
it will " index all of the current posts" :)
And not sure about 3 millions, but that request takes about 370 seconds on P4 2400/1G RAM/two SATA 120G Maxtor disks/MySQL 4.0.16 and ~427.000 posts :)

Archer 03-09-2004 08:37 AM

This part of code from block 2 strip national characters in query. E.g., russian characters not passed.

PHP Code:

        $query preg_replace("~[^\w\"\-+\* ]~i"""$query); 

If I comment it - search works.
I'm not guru in RegExp, so can't fix it by myself. Need help.

JohnWoo 03-09-2004 09:02 AM

On all servers that I have ever seen (since php2 :) "\w" match national characters :) But not on in latest PHP versions...
but if you want, you may say
$query = preg_replace("~[^\w\xC0-\xFF\"\-+\* ]~i", "", $query);
:)

Archer 03-09-2004 09:31 AM

Old expression strip russian characters at all.
Second one - left only first character.

JohnWoo 03-09-2004 10:43 AM

true...
Just tested it on 7 hosts and on 3 of them it don't work... I need to update PHP version on my servers more frequently.
And
$query = preg_replace("~[^\w\xC0-\xFF\"\-+\* ]~i", "", $query);
go to v.1.6 :)

Archer 03-09-2004 10:51 AM

Thanks!

ImportPassion 03-09-2004 03:16 PM

anyone have a test site to try with lots of posts?

Archer 03-09-2004 03:22 PM

forum.wbfree.net
~270,000 posts

heynurse 03-10-2004 05:02 AM

It looks like you have to register to search on that site? Any other sites? I doubt you want hundreds of us registering just to test out the search ;)

webrats 03-10-2004 05:18 AM

ive got 40000 post not much
forums.webrats.com
i thinking of installing this

JohnWoo 03-10-2004 07:18 AM

heynurse :)
Go to AdminCP and select

Usergroup Manager
[Edit] Unregistered / Not Logged In
check yes for
- Can View Forum
- Can View Others' Threads
- Can Search Forum
after it go to Forum Permissions and select what forums Unregistered users will be able to see, read and search :)

msimplay 03-12-2004 10:18 AM

Quote:

[Note for #3]
you may leave functions_databuild.php file without changes, but comment all build_post_index and delete_post_index
functions calls in all scripts

build_post_index line numbers around:

editpost.php
420

postings.php
701
773
901
1042
1246
1247
1511
1515

admincp/misc.php
144

includes/functions_newpost.php
402


delete_post_index line numbers around:

editpost.php
406

postings.php
699
900
1041
1244
1245
1510
1514

includes/functions_databuild.php
230
443
723
does the above in the instructions mean
either edit the databuild.php or do the editing in the files in [note 3] ?

JohnWoo 03-12-2004 10:24 AM

sorry for my English :)
it means that you may edit functions_databuild.php or comment all calls of that functions in all scripts or don't touch #3 (but then your unused word and postsindex will grow and it will take server processor time:)

msimplay 03-12-2004 10:31 AM

Quote:

Originally Posted by JohnWoo
sorry for my English :)
it means that you may edit functions_databuild.php or comment all calls of that functions in all scripts or don't touch #3 (but then your unused word and postsindex will grow and it will take server processor time:)

thank you
so basicly if i edit databuild my search index will not grow right ?
also what does this querie do
FLUSH TABLE post

as i have no permissions to execute it
but the hack seems to work without it
also does this have an affect on similar threads ?

JohnWoo 03-12-2004 10:53 AM

yes - after editing databuild, index will not grow :)
and FLUSH just clear mysql cache for post table. On some servers
ALTER TABLE post ADD FULLTEXT (title)
runs more then 10 minutes and die with error without FLUSH befor? and finish fine in 3 minutes if FLUSH was executed before. Can't explain why it happen, but it happen sometimes :)

Natch 03-12-2004 11:32 AM

Thansk for this hack John - it's gonna help no end I think :)

Great job!

[high]* Natch installs
[/high]

I also don't have the permissions to run the FLUSH query, but as you say, unless the board is HUGE, and the post table is way way bloated, the FLUSH query is not a *required* query to run for functionality ...

Nitesh 03-12-2004 11:34 AM

Thanks for the hack :)

I put this hack on my forums which has 1.1 million posts... the search works ok but unfortunately the server load has gone up now.
Current Server Load Averages: 2.75 2.48 2.45 | 161 Users Online (119 members and 42 guests)
It used to be around 1 before this hack was installed. Have you got any ideas on this?

JohnWoo 03-12-2004 01:42 PM

hmm...
Sorry Nitesh, but I had no chance to test it with more then 400.00 posts... And just now have no idea how to fight with it...
do you remember your server load numbers before instslling?

Nitesh 03-12-2004 02:06 PM

Its aright John :)

It seems my server load is fluctuating now...
Server Load Averages: 1.10 1.40 2.16 | 174 Users Online (135 members and 39 guests).
I?m on a dedicated server so there aren?t any other scripts... I think it maybe just being odd loll... I'll keep an eye on it and keep you informed.

I couldn't get simular threads to work with this either, is that included with this hack?

Anyway thank you for the hard work you've put on this script, saved me about 20 hours of search index rebuilding!

JohnWoo 03-12-2004 04:28 PM

:)
But I still thinking at "simular threads" and have no good (and not heavy for server) solution for it. But feel that it is somewhere near :)

Erwin 03-12-2004 10:14 PM

I have almost 2 million posts. Anyone installed this hack on a larger forum? I don't want to have to reindex my search table if this doesn't work. :)

ImportPassion 03-13-2004 02:05 AM

aww...c'mon, be a sport Erwin. Erwin! Erwin!

JohnWoo 03-13-2004 06:22 AM

besides why not to change scripts without touching functions_databuild.php and current words and posts index? :) after it you will be able to return back to standard without reindexing :)

Erwin 03-13-2004 12:18 PM

Quote:

Originally Posted by JohnWoo
besides why not to change scripts without touching functions_databuild.php and current words and posts index? :) after it you will be able to return back to standard without reindexing :)

That's true. :) I may try this when I find time.

mtha 03-23-2004 09:40 PM

Quote:

2. [That HighLight part can be buggy and need more testing.... Be carefull.]
you may skip this step and loose find words hightlighing
yes it is buggy :D

I tried on my board, with UTF-8 text, and the highlight is broken (when highlighting utf-8 chars)

:D I may wait for a solution for it, before puting this cool hack in use.

JohnWoo 03-24-2004 05:19 AM

Sorry, but just now I have no idea how to test it with UTF-8 :)
Will think, but can't promice someting...

Dontom 03-24-2004 06:27 PM

Hello, i tried this hack but somehow it showed far less results than the normal search (12 <-> 1000).
Currently our forums is on rc2 and I replaced search.php with vb3 gold hacked search - which might be a reason.
Tom

JohnWoo 03-24-2004 06:37 PM

you tried to change number in "Search Index Maximum Word Length" setting in adminCP?
Sorry - asking becase it looks like the most possible reason :)
And if it will continue returning too few results after setting large number there, you may try to drop fulltext index and create it again with repair and optimise requests before and after creation.

Dontom 03-25-2004 09:45 AM

I don't understand this ;)
I think the Search Index Maximum Word Length in admincp has nothing to do with mysqls fulltext index (this is limited only by entries in my.cnf regarding the fulltext index) - the maximum word length in vbs acp only limits the entries of the word table...

Recreating the mysqls fulltext index might be an idea - i have to shut down our forums tonight and will try this.
Thank you
Tom

JohnWoo 03-25-2004 10:53 AM

Quote:

Originally Posted by Dontom
I don't understand this ;)
I think the Search Index Maximum Word Length in admincp has nothing to do with mysqls fulltext index (this is limited only by entries in my.cnf regarding the fulltext index) - the maximum word length in vbs acp only limits the entries of the word table...
Tom

yes :) but see #2 in extra changes part

2. Value of old "Search Index Maximum Word Length" used to limit number of posts in the result returned by fulltext search

I used value of that setting just to free database from searces that may return too much results - sorry :)

Dontom 03-25-2004 11:16 AM

JohnWoo, thank you!
LOL, didn't see this ;)

will try it again...

JonP 03-25-2004 09:39 PM

In the process of installing, 1.3 million posts.

alter tables are taking ages ... :(

Will keep you updated.

JonP 03-25-2004 10:34 PM

Still altering... sigh.

Dontom 03-26-2004 03:02 AM

Ok, this hack seems to work on our 1.1mio posts board. :up: :up:

I will be able to say something about load after sunday evening, which is one of
our most freuqented days
Thank you for this hack!
Tom

JonP 03-26-2004 04:03 AM

Had to reindex, still indexing, forum's been down most the day ...

Dontom 03-26-2004 04:10 AM

This took iirc ~ less than half an hour.. you know that you do not have to reindex using vbulletin? Mysql will create this automatically for you as soon as you enter the sql commands as instructed...
Tom


All times are GMT. The time now is 01:50 AM.

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.01656 seconds
  • Memory Usage 1,822KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete