Previous Thread
Next Thread
Print Thread
Rating: 5
#283893 03/08/2005 12:57 AM
Joined: Jul 2001
Posts: 1,157
Likes: 82
coffee and code
coffee and code
Joined: Jul 2001
Posts: 1,157
Likes: 82
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.

Last edited by id242; 07/15/2005 5:18 PM.
Sponsored Links
Joined: Jul 2004
Posts: 43
User
User
Joined: Jul 2004
Posts: 43
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...
Joined: Jul 2001
Posts: 1,157
Likes: 82
coffee and code
coffee and code
Joined: Jul 2001
Posts: 1,157
Likes: 82
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


Current developer of UBB.threads PHP Forum Software
Current Release: UBBT 7.7.5 // Preview: UBBT 8.0.0
isaac @ id242.com // my forum @ CelicaHobby.com
Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
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=

Joined: Jul 2001
Posts: 1,157
Likes: 82
coffee and code
coffee and code
Joined: Jul 2001
Posts: 1,157
Likes: 82
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.


Current developer of UBB.threads PHP Forum Software
Current Release: UBBT 7.7.5 // Preview: UBBT 8.0.0
isaac @ id242.com // my forum @ CelicaHobby.com
Sponsored Links
Joined: Jul 2004
Posts: 43
User
User
Joined: Jul 2004
Posts: 43
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...
Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
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

Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
It's a pretty cool concept id242. It's what I'd do as well if using a newer threads version, most definitely.

Joined: Sep 1999
Posts: 76
Power User
Power User
Offline
Joined: Sep 1999
Posts: 76
Oh my God, thank you! *tears of joy*

Joined: Sep 1999
Posts: 76
Power User
Power User
Offline
Joined: Sep 1999
Posts: 76
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?

Sponsored Links
Joined: Sep 1999
Posts: 76
Power User
Power User
Offline
Joined: Sep 1999
Posts: 76
[]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===

Joined: Jul 2001
Posts: 1,157
Likes: 82
coffee and code
coffee and code
Joined: Jul 2001
Posts: 1,157
Likes: 82
Thanks Myke. Original post has been updated.

This code-modification has been moved from BETA to FINISHED - Thanks everyone


Current developer of UBB.threads PHP Forum Software
Current Release: UBBT 7.7.5 // Preview: UBBT 8.0.0
isaac @ id242.com // my forum @ CelicaHobby.com
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
thank you, I can use search now intelligently


- Allen wavey
- What Drives You?

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)