id242
Member
   
Reged: 05/23/03
Posts: 166
|
|
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:
// ---------------------------------------------------------
// The forums we are searching will be in a different format
// depending on where we are coming from
insert BEFORE it:
Code:
// ---------------------------------------------------------
// FIX Search code ===START===
if ($Words != "") {
if (!strstr($Words, '"')) {
if (!strstr($Words, " +")) {
$Words = str_replace(" ", " +", $Words);
// $Words = "+".$Words;
}
}
$Words = str_replace(" +-", " -", $Words);
$Words = str_replace(" ++", " +", $Words);
}
// FIX Search code ===END===
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.
Edited by id242 (07/15/05 05:18 PM)
|
FusionGal
User
Reged: 07/22/04
Posts: 46
|
|
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?
-------------------- Helping the lost & lonely one sweet soul at a time...
|
id242
Member
   
Reged: 05/23/03
Posts: 166
|
|
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
-------------------- "Humor is everywhere, in that there's irony in just about anything a human does." - Bill Nye (The Science Guy)
|
Twisty
Code Monkey
  
Reged: 09/26/03
Posts: 546
|
|
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=
-------------------- Twisty 
MAMEWorld
|
id242
Member
   
Reged: 05/23/03
Posts: 166
|
|
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.
-------------------- "Humor is everywhere, in that there's irony in just about anything a human does." - Bill Nye (The Science Guy)
|
FusionGal
User
Reged: 07/22/04
Posts: 46
|
|
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?
-------------------- Helping the lost & lonely one sweet soul at a time...
|
Twisty
Code Monkey
  
Reged: 09/26/03
Posts: 546
|
|
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
-------------------- Twisty 
MAMEWorld
|
Twisty
Code Monkey
  
Reged: 09/26/03
Posts: 546
|
|
It's a pretty cool concept id242. It's what I'd do as well if using a newer threads version, most definitely.
-------------------- Twisty 
MAMEWorld
|
Myke
Power User
Reged: 09/06/99
Posts: 66
Loc: Sydney, Australia
|
|
Oh my God, thank you! *tears of joy*
|
Myke
Power User
Reged: 09/06/99
Posts: 66
Loc: Sydney, Australia
|
|
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?
|
Myke
Power User
Reged: 09/06/99
Posts: 66
Loc: Sydney, Australia
|
|
Quote:
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=== if ($Words != "") {
...
} // FIX Search code ===END===
|
id242
Member
   
Reged: 05/23/03
Posts: 166
|
|
Thanks Myke. Original post has been updated.
This code-modification has been moved from BETA to FINISHED - Thanks everyone
-------------------- "Humor is everywhere, in that there's irony in just about anything a human does." - Bill Nye (The Science Guy)
|
AllenAyres
Wizard
  
Reged: 10/12/01
Posts: 5562
Loc: Texas
|
|
thank you, I can use search now intelligently
-------------------- - Allen
- Join Team ThreadsDev
- It's not about you.
|
huligancho
Lurker
Reged: 08/27/05
Posts: 1
|
|
I dont understand how to do that
|