UBB.Dev
Posted By: isaac Finished-[6.4-6.5] Search FIX - 03/08/2005 7:57 AM
Mod Name / Version: Search FIX

Description: Fixes the search modules found in UBBT 6.4+

Unlike conventional search engines such as google and yahoo... When entering multiple search terms to UBBT, you are required to use "+" or "-" in front of each word. If you don't, your results will display ANY matches of ANY of the words.

This fixes the "ANY, ALL or SOME" issue and returns functionality of your board's search engine to what most users are familiar with in the real world.

After inserting this code, the "ANY" feature will no longer work, but the plus side is that your users will no longer be afraid to use your search engine since they will have more positive results returned of what they are looking for.

(it basically returns your search "word" engine to that of what it was in version 6.3 and prior)

Working Under: UBB.Threads 6.4-6.5

Mod Status: Finished

Any pre-requisites: none

Author(s): id242

Date: 03/07/05

Credits: Thanks to Myke for the update!

Files Altered: dosearch.php

New Files: none

Database Altered: no

Info/Instructions: in dosearch.php, find:
Code
 <br />// --------------------------------------------------------- <br />// The forums we are searching will be in a different format <br />// depending on where we are coming from <br />


insert BEFORE it:
Code
 <br />// --------------------------------------------------------- <br />// FIX Search code ===START=== <br />if ($Words != "") { <br />	if (!strstr($Words, '"')) { <br />		if (!strstr($Words, " +")) { <br />			$Words = str_replace(" ", " +", $Words); <br />//			$Words = "+".$Words; <br />		} <br />	} <br />	$Words = str_replace(" +-", " -", $Words); <br />	$Words = str_replace(" ++", " +", $Words); <br />} <br />// FIX Search code ===END=== <br />


Code has been updated with Myke's addtional code from #128269 - 06/09/05 04:32 AM, THANK YOU!

[Version numbers edited: Thanks for the update twisty The correct ubbt version numbers that this fix works under has been corrected - also tested and working fine in a 6.5 install]

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
Posted By: Tina Re: Beta-[6.3-6.4] Search FIX - 03/13/2005 9:54 AM
Is this an issue in 6.5.1 and, if so, will this work? I, too, have been dissatisfied with too many unfocused search results.

Is it also true that the search engine does not search for strings of words between quotes?
Posted By: isaac Re: Beta-[6.3-6.4] Search FIX - 03/13/2005 4:30 PM
this may also work in 6.5x... but I am currently not running this version.

(Slightly off-topic) I am however running a 100% unmodified version of "mysql.inc.php" from the 6.5x demo version with my current 6.2x highly hacked version - and there are absolutely NO issues. I have found that the error reporting is displayed much better using this file instead of the stock one that comes with 6.2x
Posted By: Twisty Re: Beta-[6.3-6.4] Search FIX - 03/13/2005 8:38 PM
The thing with searches, is that the KISS principle strongly applies. If it's too complicated for the average user to easily grasp then it's going to be far too frustrating and people will just avoid using it.

This is why I like the search functionality in 6.3 the best. It's simple and straight-forward. What I did was hack it up by adding in an extra field to 'limit results by username'. Plus I also coded in the ability to see how many results are returned, with each page showing, for example...

1-25 of 60 (for page 1)
26-50 of 60 (for page 2)
51-60 of 60 (for page 3)

Also, there was a bug in the 6.3 dosearch script which prevented the search 'By Username' selection under Search Options from working that I fixed.

I'm quite happy with it now, very user friendly imho...

http://www.mameworld.info/ubbthreads/search.php?Cat=
Posted By: isaac Re: Beta-[6.3-6.4] Search FIX - 03/14/2005 12:27 AM
Exactly, Twisty! And that is why I wrote this small hack as posted above - because it really does return the search back to the KISS principle.

Many of my members are not programmers and really don't care to be. The use of " + " and " - " in their search arguments is just not going to happen.

So i whipped up the above bit of code so search would work the same functionality as in 6.3x and prior - along with the same ability to select ("hand pick") different forums or cats as you want.
Posted By: Tina Re: Beta-[6.3-6.4] Search FIX - 03/14/2005 7:14 AM
Very nice, Twisty... I imagine this is a bit different than the aforementioned code. Is this something you can share? I like the limit by "username" addition too. Is it, too, possible to place multiple usernames?
Posted By: Twisty Re: Beta-[6.3-6.4] Search FIX - 03/14/2005 11:51 AM
No multiple usernames aren't supported Sandi. It isn't something that I really find myself needing to be honest.

As for sharing the code, that probably wouldn't work for a number of reasons. I think some of the changes I made are version specific, and furthermore this is something I did a while back and probably can't even remeber what was changed exactly. Sorry
Posted By: Twisty Re: Beta-[6.3-6.4] Search FIX - 03/14/2005 12:06 PM
It's a pretty cool concept id242. It's what I'd do as well if using a newer threads version, most definitely.
Posted By: Myke Re: Beta-[6.4-6.5] Search FIX - 04/27/2005 1:06 PM
Oh my God, thank you! *tears of joy*
Posted By: Myke Re: Beta-[6.4-6.5] Search FIX - 06/01/2005 4:09 PM
I'm running 6.5.

After installing this fix, did anyone notice the "show all user's posts" when viewing a profile no longer works anymore? The following error message is displayed:

Warning: Compilation failed: nothing to repeat at offset 2 in /path/to/ubb.t/dosearch.php on line 459

I also get the same message if I just try a username search via the search page, except that results are actually shown as well.

Anyone else experience this and have a fix?
Posted By: Myke Re: Beta-[6.4-6.5] Search FIX - 06/09/2005 1:32 PM
[]Myke said:
I'm running 6.5.

After installing this fix, did anyone notice the "show all user's posts" when viewing a profile no longer works anymore? The following error message is displayed:

Warning: Compilation failed: nothing to repeat at offset 2 in /path/to/ubb.t/dosearch.php on line 459

I also get the same message if I just try a username search via the search page, except that results are actually shown as well.

Anyone else experience this and have a fix? [/]

Just wanted to share the fix for a problem I reported. BTW, I was getting the same error with the Active Topics and View Recent Messages links.

Anyway, the error seemed to be due to the fact that those specific searches have no search words, yet the fix for this mod assumes there are and starts doing it's string replaces. To fix this, just enclose the fix in an if statement to check for the presence of words before proceeding:

// FIX Search code ===START===
[:"red"]if ($Words != "") {[/]

...

[:"red"]}[/]
// FIX Search code ===END===
Posted By: isaac Re: Beta-[6.4-6.5] Search FIX - 07/12/2005 9:26 PM
Thanks Myke. Original post has been updated.

This code-modification has been moved from BETA to FINISHED - Thanks everyone
Posted By: AllenAyres Re: Finished-[6.4-6.5] Search FIX - 07/12/2005 9:36 PM
thank you, I can use search now intelligently
© UBB.Developers