UBB.Dev
Posted By: JustDave [UBBT 6.0] Search Page Upgrade - 07/03/2002 5:13 AM
This will allow the user to specify searching the subject or body only or both. It also allows specifying the username in addition to the search criteria and not as an either/or option.

This also provides the fix so that showflat.php and showthreaded.php display your multiple word search results all words are highlighted.

There seemed to be an error for me in dosearch.php where the line

if ($Searchpage 0) {

is used.

I had to change this to

if ($Searchpage) {

to make it work for me.


Give me some feedback on how this goes. It may need some adjusting.

Attached File
51739-searchupgrade.zip  (14 downloads)
Posted By: AllenAyres Re: [UBBT 6.0] Search Page Upgrade - 07/03/2002 5:40 AM
seems to be working well here.. let me know if it looks like I did something wrong

In dosearch, my file looks like this:

if ($Searchpage < 0) {
$html -> not_right($ubbt_lang['NO_MORE'],$Cat);
}
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade - 07/03/2002 5:50 AM
That's probably how it should look.

I just looked again at my last download from the members area of ubbthreads-6-0-2.tar.gz and it does look like what I showed. Is your file from an earlier version?
Posted By: AllenAyres Re: [UBBT 6.0] Search Page Upgrade - 07/03/2002 5:54 AM
I don't think so, tho I may have missed it in an earlier "upgrade"
Posted By: MTO Re: [UBBT 6.0] Search Page Upgrade - 07/03/2002 6:28 PM
My ubbthreads-6-0-2.tar.gz says the same as AllenAyres:
[:"#666666"]
if ($Searchpage < 0) {
$html -> not_right($ubbt_lang['NO_MORE'],$Cat);
} [/]
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade - 07/03/2002 11:21 PM
Now I'm going to have to go download it again. LoL I wonder how that can be? I looked at the file again and it does not have the < in it.
Posted By: msula Re: [UBBT 6.0] Search Page Upgrade - 07/03/2002 11:35 PM
That is odd. Thanks for the hack btw, works great
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade - 07/03/2002 11:50 PM
posted by MTO:
My ubbthreads-6-0-2.tar.gz says the same as AllenAyres:
[:"#666666"]
if ($Searchpage < 0) {
$html -> not_right($ubbt_lang['NO_MORE'],$Cat);
} [/]


I just downloaded it again and know what? Mine doesn't say that... LoL

Perhaps winzip is removing things? LoL I hope not.
Posted By: AllenAyres Re: [UBBT 6.0] Search Page Upgrade - 07/04/2002 12:00 AM
do do do do ...

sounds like the twilight zone
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade - 07/04/2002 12:09 AM
LoL yes it is rather bewildering...
Posted By: Aglavalin Re: [UBBT 6.0] Search Page Upgrade - 07/05/2002 1:35 AM
Hmm, I'm getting some ugly SQL errors on 6.0.2 on win32...

Check them out if you dare! LOL

http://www.newoutriders.org/ubbtest/search.php
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade - 07/05/2002 6:50 AM
There needs to be a space on each side of the OR

(B_Body LIKE '%dddd%')OR (B_Subject LIKE '%dddd%') )

should be looking like this (of course if there are no errors you wont see this)

(B_Body LIKE '%dddd%') OR (B_Subject LIKE '%dddd%') )


Hope that helps.
Posted By: Aglavalin Re: [UBBT 6.0] Search Page Upgrade - 07/05/2002 8:29 AM
OK, I think I got the spacing fixed but I still get the error. I have a space in front of each AND and OR now in the code added to the dosearch.php
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade - 07/05/2002 8:58 AM
That is odd. Could you post your code and template changes? I'll see if I can spot what went wrong.
Posted By: JustDave [UBBT 6.0] Search Page Upgrade (PATCH) - 07/08/2002 1:12 AM
This patch will make the "Show all user's posts" link in the profiles work correctly.

Above this line:

if (($Match == "Or") && ($Words)) {

add this:

if ($Match == "Username") {
$Match = "";
$ByUsername = $Words;
$Words = "";
}


I have attached the updated instructions.

Attached File
52117-searchupgrade.2.0.zip  (7 downloads)
Posted By: Max Fisch Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 07/08/2002 1:41 AM
small error

Hi Dave,
Just installed this one, works great! Thanks.
A typo: you mention that in dosearch.php, you need to replace
if ($Searchpage 0) {
with
if ($Searchpage) {

But it looks like in the latest version, the problem was fixed in the base code... and it looks like it should really be

if ($Searchpage < 0) {

Regards,
Max


Posted By: Lisa_P Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 07/08/2002 1:47 AM
posted by Max Fisch:
small error

and it looks like it should really be

if ($Searchpage < 0) {

Regards,
Max



Shhhhh-- Dave can't see the [:"red"] < [/] and swears it isn't there.
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 07/08/2002 1:49 AM
LoL this has been gone over in this thread. When I look at a fresh dosearch.php script right out of the .tar.gz file from the latest version release I have that error.

Oddly enough, someone sent me a dosearch.php script that they could not make work with the hack and I noticed they had the same error.

I have no idea why some have it (mostly me) and some dont.


So if your dosearch.php doesn't match the line that needs changing you probably shouldn't change it.
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 07/08/2002 1:50 AM
posted by Lisa_P:
posted by Max Fisch:
small error

and it looks like it should really be

if ($Searchpage < 0) {

Regards,
Max



Shhhhh-- Dave can't see the [:"red"] < [/] and swears it isn't there.




LoL @ Lisa


I swear!
Posted By: Max Fisch Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 07/08/2002 3:27 AM
Got it... but I was trying to say that if someone does need to change it, they should change it to " < 0 " as opposed to removing the 0 as your latest attached instructions state.

Cheers,
Max
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 07/08/2002 3:32 AM
Yeah I thought of that after I uploaded it. I forgot that Allen had showed me what it should look like. LoL wish there was a way to edit attachments.

Perhaps I'll fix that and then uploaded to the finished mods section.

Not much else to do with this one. Is anyone else besides Aglavalin having problems with this hack on a windows box?
Posted By: msula Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 07/08/2002 4:04 AM
posted by JustDave:
This patch will make the "Show all user's posts" link in the profiles work correctly.

Above this line:

if (($Match == "Or") && ($Words)) {

add this:

if ($Match == "Username") {
$Match = "";
$ByUsername = $Words;
$Words = "";
}


I have attached the updated instructions.


Hey Dave, saw a new attachment in this post. Can we just use the patch you mentioned or is there something else new in the new attachment?
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 07/08/2002 4:26 AM
If your search is working then all you probably need is the patch.
Posted By: msula Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 07/08/2002 4:30 AM
great, patched up and working fine. Thanks!
Posted By: AllenAyres Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 07/18/2002 6:36 AM
posted by JustDave:
Yeah I thought of that after I uploaded it. I forgot that Allen had showed me what it should look like. LoL wish there was a way to edit attachments.



Check out scream's latest changes to 6.1, that's coming

I think I may have found a buglet with this or in the base code. I was looking for a php editor and typed that in the search box and got this:
click me

Seems it inserts a bold tag around every instance of php, even when it's a link to a smiley here, since /php/ is in the url Someway to fix this? I thought rick had fixed it in the base code.
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 07/18/2002 6:46 AM
hmmmm perhaps adding a space before and after the word that is to be highlighted?

In the showflat.php script try changing this:

$Body = @eregi_replace($searchwords[$x],"<b><i>".$searchwords[$x]."</i></b>",$Body);
$Body = preg_replace("|(<a\s*[^>]+)<b><i>(\Q$searchwords[$i]\E)</i></b>([^>]*>)|i","\\1\\2\\3",$Body);


to this:

$Body = @eregi_replace(" $searchwords[$x] ","<b><i>".$searchwords[$x]."</i></b>",$Body);
$Body = preg_replace("|(<a\s*[^>]+)<b><i>(\Q $searchwords[$i] \E)</i></b>([^>]*>)|i","\\1\\2\\3",$Body);


(I think that's how it would be... lol)

showthreaded.php may be the same as well...
Posted By: Gardener Search PM:s - 08/02/2002 6:44 AM
I've added the possibility for users to search through their sent and received PM:s to this hack. Instead of selecting a forum to search for, an PM-option can be selected instead. There is also a quick search box added to the PM box on My Home.

At the moment the code is a bit ugly, it works, but since the search is somewhat different for PM:s there is a lot of if statements. I don't really like that everything inside the loop that iterates through the search results is within an if statement and it does different things based on if the user searches the PM:s or the posts. I've also done an extra template for the PM:s search results. But I've used the normal search script because I didn't want to have two search pages and much of the code that builds the query is the same.

If anyone is interested in this hack I'll try to clean it up a bit and make instructions for it.
Posted By: caymuc Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 08/07/2002 5:10 PM
There is still a bug.
I did Search for Username and typed my name.

I see more than one page. Good.
I click the forward button and I see not only my messages but tons of other messages too...

(You can try the search here at ubbdev.com and you see what I mean.)

Greetings
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 08/08/2002 4:04 AM
After this part of the hack code:


if ($Match == "Username") {// profile "Show all user's posts" search link fix
$Match = "";
$ByUsername = $Words;
$Words = "";
}


add this:


$EByUsername = rawurlencode($ByUsername);



And add the variables to the navigation links in the dosearch.tmpl file:

<a href="{$config['phpurl']}/dosearch.php?Cat=$Cat&Forum=$URLForum&Words=$URLWords&Match=$URLMatch&Searchpage=$prevpage&Limit=$Limit&Old=$Old">

and

<a href="{$config['phpurl']}/dosearch.php?Cat=$Cat&Forum=$URLForum&Words=$URLWords&Match=$URLMatch&Searchpage=$nextpage&Limit=$Limit&Old=$Old">



would be:



<a href="{$config['phpurl']}/dosearch.php?Cat=$Cat&ByUsername=$EByUsername&Forum=$URLForum&Words=$URLWords&Match=$URLMatch&Searchpage=$prevpage&Limit=$Limit&Old=$Old">

and

<a href="{$config['phpurl']}/dosearch.php?Cat=$Cat&ByUsername=$EByUsername&Forum=$URLForum&Words=$URLWords&Match=$URLMatch&Searchpage=$nextpage&Limit=$Limit&Old=$Old">



Not sure if this will work. Just guessing.
Posted By: caymuc Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 08/08/2002 10:08 AM
Hi Dave,
thank you very much for the fix!!!

I tested it:

*show all messages of other user (profile): ok
*show all messages of myself (profile): ok
*Seach for all posts of other username: ok
*Seach for all posts of myself: does not work
(That means if I click: show next page 3 times here: ERROR)

UPDATE: I was too quick, for some reason now ALL seems to work. No idea what I did wrong, when testing!!!!

Anyone else see this too?
Posted By: Gardener Re: [UBBT 6.0] Search Page Upgrade (PATCH) - 08/08/2002 2:30 PM
Nope, all seems to work for me after adding the patch.
Posted By: Lisa_P Re: Search PM:s - 08/09/2002 7:33 PM
[]I've added the possibility for users to search through their sent and received PM:s


I'd LOVE to see this!
Posted By: Gardener Re: Search PM:s - 08/11/2002 12:21 AM
It's coming, it is finished, I just need to write the install instructions. I got sidetracked on fixing some bugs in threads and writing the BypassModeration mod. It will probably take a couple of days until it's ready though.
Posted By: Gardener Search Page Upgrade 3.0beta (Search PM) - 08/19/2002 3:18 AM
New to this version
I've added the possibility to search the Private Messages. I hope I've got all the instructions correct, but I'm not sure. Please let me know if it works. =]

Mod Name / Version Searchpage Upgrade 3.0beta
Description This will add the option to search subject or body or both. Also, it allows for a seperate username field so searches can be done with specific criteria along with the username. It also allows for users to search through their sent and received Private Messages.
Working under UBB.threads 6.0.3
Any pre-requisites None
Author(s) Dave Lozier, Gardener
Credits Gardener for adding the PM-search.
Demo Not at the moment
Files Altered dosearch.tmpl, dosearch.php, myhome.tmpl, languages/dosearch.php
Database Altered No
New Files dosearch_PM.tmpl
Any other info This hack is heavily based on the Searchpage Upgrade 2.0 hack by Dave Lozier.


Attached File
What are the chances this will work if I install on 6.1b1 ?

I just thought id ask before attempting it on a test board
Posted By: JustDave Re: Search Page Upgrade 3.0beta (Search PM) - 08/30/2002 2:13 AM
I haven't seen the new code Gardener has added but from what I can remember there shouldn't be a problem with what I had added. Has anyone else got this running with 6.1 BR1 ?
Posted By: Gardener Re: Search Page Upgrade 3.0beta (Search PM) - 08/30/2002 2:48 AM
And I haven't seen 6.1b1 yet so I can't really tell either. But if the original code works, this version has a good chance of working as well.
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade - 09/25/2002 2:30 AM
Yes, once again I had problems with this:

code:

if ($Searchpage 0) {
$html -> not_right($ubbt_lang['NO_MORE'],$Cat);
}



I know it should be this:

code:

if ($Searchpage < 0) {
$html -> not_right($ubbt_lang['NO_MORE'],$Cat);
}




But while editing with Dreamweaver it kept removing the < for some strange reason.

I ended up changing the file to a "text" file and then edited it and uploaded it and then changed the name back to a php file and it worked!!!

Finally I know I'm not crazy. It was dreamweaver all the long... (I hope)
Posted By: 3DSHROOM_dup1 Re: [UBBT 6.0] Search Page Upgrade - 11/12/2002 7:02 PM
Is it just me or in dosearch.php......

Shouldn't this:

$prevlinkstart = "<a href="{$config['phpurl']}/dosearch.php?Cat=$Cat&Forum=$URLForum&Words=$URLWords&Match=$URLMatch&Searchpage=$prevpage&Limit=$Limit&Old=$Old">";

Be this:

$prevlinkstart = "<a href="{$config['phpurl']}/dosearch.php?Cat=$Cat&Forum=$URLForum&Words=$URLWords&Match=$URLMatch&Searchpage=$prevpage&Limit=$Limit&Old=$Old&ByUsername=$ByUsername">";

... and you would need to do the same for the $nextlinkstart
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade - 11/12/2002 7:03 PM
Yes you are correct. I believe I forgot to add that in here too. I had mentioned this change somewhere around here before but had forgotten about it. Thanks.
Posted By: 3DSHROOM_dup1 Re: [UBBT 6.0] Search Page Upgrade - 11/12/2002 7:04 PM
{$ubbt_lang['SEARCH_PM']} Seems to be used in search.tmpl but in the instructions it isn't mentioned as being added to language/search.php
Posted By: JustDave Re: [UBBT 6.0] Search Page Upgrade - 11/12/2002 7:13 PM
I believe that was Gardener's addition to the search page upgrade. I haven't looked at the code myself but perhaps he can help on this one.
Posted By: Gardener Re: [UBBT 6.0] Search Page Upgrade - 11/12/2002 7:24 PM
Yes, it seems that I missed the language string in search.pm in the instructions. Just add this line to search.pm:

$ubbt_lang['SEARCH_PM'] = "Search your Private Messages";

I'll update the instructions and repost.
Posted By: Gardener [UBBT 6.1.0] Search Page Upgrade 3.0beta2 - 11/12/2002 8:20 PM
3DSHROOM mentioned a slight problem with the search upgrade for 6.1.x which is fixed in this version as well as another thing related to it. I have also fixed some missing language strings and updated the instructions for 6.1.0.

The new version is attached to this post.

Attached File
Thanks Gardener!

Warm regards

Nikos
Glad to see I could help out...

A suggestion... Make an option to search for "parent threads" (ie B_Parent=='0') or "threads and replies". It's usefull with larger boards when you need to cut down the number of duplicate matches.
Posted By: Gardener Search page suggestions - 11/13/2002 8:23 AM
That's a good idea, I'll look into it as soon as I have some spare time, but I won't promise anything.

Another tip I got from one of my users was to add both start and end for the date range to limit the search even more.

Does anyone else have any suggestions for the search page while I'm (possibly) at it?
Posted By: dimopoulos Re: Search page suggestions - 11/13/2002 11:41 AM
How about using + and - on the search for the words. For instance +ubb +threads will show me every post that has ubb AND threads in it (body or subject) but +ubb -threads will show only the ones that have the ubb in them - ubbthreads will be ignored.

I hope I have not opened pandora's box

Warm regards

Nikos
Posted By: Gardener Re: Search page suggestions - 11/13/2002 5:24 PM
That would be a good idea, but writing a parser for that would be a bit harder. I'll keep it in mind though.
Posted By: 3DSHROOM_dup1 Re: Search page suggestions - 01/02/2003 5:30 AM
Any chance in getting this workable under 6.2? My users love this mod (as do I). It's kind of sad that this isn't an official feature. The default search is very basic.
Posted By: Gardener Re: Search page suggestions - 01/02/2003 4:53 PM
Since I don't have access to the member area anymore I haven't even looked at any 6.2 code so I couldn't say. Maybe someone else could do the necessary changes. I agree with you that the extended search possibilities should be a standard feature.
Posted By: Anno Re: Search page suggestions - 01/08/2003 2:17 PM
>Since I don't have access to the member area anymore

Why not?
Posted By: JoshPet Re: Search page suggestions - 01/08/2003 6:30 PM
He he.... it costs money.
Posted By: Gardener Re: Search page suggestions - 01/08/2003 7:03 PM
Yup, it does, and I'm a poor student who can't afford it at the moment. =[
Posted By: 3DSHROOM_dup1 Re: Search page suggestions - 01/08/2003 9:39 PM
For as much work as you, JoshPet, and JustDave do on Threads, they should give you a free lifetime license I was lucky enough to have a license before they were bought by Infopop, so I only have to pay a little over $30 a year
Posted By: Gardener Re: Search page suggestions - 01/08/2003 10:06 PM
Yeah, me too, so it isn't that much money, but it's still a bit more than I can pay at the moment. I'll try to get the rest of the admins to help me pay it soon though, shouldn't be any problem.
Posted By: 3DSHROOM_dup1 Re: Search page suggestions - 01/09/2003 1:03 AM
Good to hear
Posted By: Anno Re: Search page suggestions - 01/10/2003 12:37 PM
Looks like the problem is solved, thanks to matts:
https://www.ubbdev.com/threads/php/showflat.php?Cat=&Board=finished&Number=64283
© UBB.Developers