UBB.Dev
Posted By: omegatron Beta-[6.4] Yet Another Search Mod 2.1 - 12/11/2003 6:12 AM
Mod Name / Version: Yet Another Search Mod 2.1

Description: Yet Another Search Mod 2.0

This will give you 3 new options while searching:
1. Display All Posts (standard and default)
2. Display Last Posts (like .classic I guess)
3. Display Main Posts (like something somewhere)

This is based on JustDave's mod for 6.2 and 6.4 seems to make it even easier to do this so here it is.

You can see a demo at my site

http://www.reeftalk.com/ubbthreads/search.php

Working Under: UBB.Threads 6.4

Mod Status: Beta

Any pre-requisites:

Author(s): JustDave

Date: 12/10/03

Credits: chillin, DaLanTech, Photopost and Omegatron

Files Altered: search.tmpl, dosearch.tmpl, search.php(language files) and dosearch.php

New Files: None

Database Altered: N/A

Info/Instructions:

UPDATED TO INCLUDE INSTRUCTIONS FOR 6.4.1 with the new search parameters.

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.


Attached File
101595-YASM2.1.txt  (131 downloads)
Posted By: Ian_W Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/11/2003 3:50 PM
Thanks for updating this one
Posted By: Zarzal Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/11/2003 4:04 PM
works great, thank you.
Posted By: PhotoPost Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/11/2003 5:26 PM
Funny thing is, my users wouldnt understand what "Display All Last Posts" and "Display All Main Posts" mean. lol
Posted By: Zarzal Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/11/2003 8:03 PM
possible modification:

Display All Main Posts =

display threadname as result only
display threads where result was found
Posted By: VWDerf Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/12/2003 7:35 AM
Seems:
2. Display Last Posts (like .classic I guess)

Isn't working. I did a hack for it in 6.3, but it wasn't elegant. Any ideas on updating this better?
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/12/2003 10:46 PM
Well the way it is it seems to pull all replies to a thread.

People report that it did not work in 6.3 but it did in 6.2

I have a 6.2 dosearch.php but see no reason or difference where it would break it.
I have tried a few things. However for the most part I was just happy to update the mod to be able to break apart main threads from replies when searching.

I am continually searching for the difference in 6.2 versus 6.3,6.4 that causes this to break but then I never ran this to 6.2 to confirm it worked correct there.
Posted By: VWDerf Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/13/2003 1:46 AM
Prior to 6.3 B_last_post and B_posted were only equal in th elast post. Since 6.3 the two fields are always equal.


I managed to get it to work in 6.3 by doing this:
https://www.ubbdev.com/forum/showflat.php?Cat=0&Board=php&Number=88035#Post88035

I was hoping someone came up with a more elegant way, as it's not a great hack I did and feel it could be sped up a bit somehow.
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/13/2003 4:41 AM
Well unfortunately that may be about the only way to do it is to compare with a LEFT JOIN on the posts table.

I updated the hack with a variation of your hack as I felt it was not needed to double check the t1.B_Approved twice.

But it does work as intended with one exception. Since your using B_Main IS NULL you will also pull in any posts with no replies. However this is much preferable than showing all replies to a thread.
Posted By: chillin Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/17/2003 5:28 AM
werd! glad to find this one updated! thanks omegatron
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/17/2003 6:05 AM
Actually someone specifically asked for it so I dusted it off.
Posted By: chillin Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/18/2003 9:20 AM
hmmm my db is not liking the left join business...
Posted By: smilesforu Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/18/2003 12:05 PM
Thanks works great
Posted By: Dalantech Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/18/2003 2:41 PM
[]chillin said:
hmmm my db is not liking the left join business... [/]

I can't use it either -the last posts takes almost a minute to generate on my forum
Posted By: VWDerf Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/18/2003 5:42 PM
It's working for me, but I do get some slowdowns when things get busy. Since "today's active topics" is an absolute requirement, I can't take it off to really test the speed. If this is the slowdown issue, anyone have any good ideas to dealing with this better?
Posted By: chillin Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/18/2003 5:48 PM
While working on this last night i think i crashed mysql on my shared server, sorry host!

There has to be a better way to do this.... i've been lookin at postlist.php to see how they grab the last poster on a thread for clues, but I'm not getting anything.

frustrating. anyone know why this is no longer functional? eg what changes have been made?
Posted By: JoshPet Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/18/2003 7:10 PM
Since the search function was changed a good deal in 6.4 - I think this mod needs the queries reworked or it'll bury 6.4 sites. Rick offers suggestions here:
https://www.ubbdev.com/forum/showthreaded.php/Cat/0/Number/102369
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/18/2003 7:24 PM
I updated the mod to take advantage of Rick's suggestions

Now the only display thing I do not like is that it returns the main thread but when you click it does take you to the last post. It does also have the posterid and time set right as well. Would be nice to figure out how to show the true last post though.
Posted By: chillin Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/18/2003 11:52 PM

Rokken! That is working like a charm. I haven't installed the YASM yet but tweaked my "module" in Mambo, and changed the IIP Pal for Current Threads and both are working wonderfully.

Personally I like having the original thread name displayed... the "old" way just showed a bunch of Re: BLAH this looks much more clean.

I have attached my currenthreads.pal as a text file if anyone wants it.

Thanks for the help everyone.

Attached File
102411-currentthreadspal.txt  (29 downloads)
Posted By: chillin Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/20/2003 8:04 AM
my vigilant users found a few bugs in the script. when searching using $displaytype = "last" the post time was incorrect (it was showing the original post time, not the last reply) and the user link to the last poster profile was linking to the Original poster's profile. picky, picky!

I have attached the corrections to the mod that fixes both issues above.
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/20/2003 2:14 PM
Thanks first post updated with changes. Verified and accurate.
Posted By: Dalantech Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/20/2003 9:53 PM
I got it to work on Da Forum, but I'm having trouble creating hyperlink to the lasy posts -and I think it's due to the way that the $Forum variable is being handled. The default past 24 hour display link on the main index is:

Code
 http://www.dalantech.com/ubbthreads/dosearch.php?Cat=&Forum=All_Forums&Words=&daterange=1&newertype=d&newerval=1&Limit=25 


Good to know since the way that date ranges are handled is different in 6.4

What I tried to do is just add &displaytype=Last to the end of that link. Unfortunately all I get are the last posts in the forums that are open to everyone -and not the forums that you have to be registered to view. I know it's not a problem with the last posts querry in the dosearch.php file since the "Display all last Posts" in the search.php script works.

I think it's a problem with the way that the $Forum variable is handled in the 6.4 version of dosearch.php. In the old version the $Forum variable was generated by a get input function ($Forum = get_input("Forum","both");), now it's an array and you can't pass All_Forums in a url -or if you can it's not working, or not checking to see if you are registered.

This would be much easier if the last posts were a part of Threads...
Posted By: chillin Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/22/2003 12:49 AM
[]
This would be much easier if the last posts were a part of Threads... [/]

AMEN! But then we wouldn't be having all of this fun
Posted By: VWDerf Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/29/2003 3:41 AM
Has anyone been able to get it working correctly with the indexing AND displaying the right post information in the search results for "last"?

I haven't and feel it's been causing me a lot of grief with 6.4 as it so soo much slower due to this.:(
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/29/2003 4:17 AM
This has been working fine with the last post information. Was updated over a week ago with suggested code by the master Scream himself
Posted By: chillin Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/29/2003 6:36 AM
yeah i have it working fine at my site, pm me if you need some more help, but be sure to try re-applying the .txt file on the first post as it has changed/updated with scream's suggestions
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/29/2003 6:47 AM
Dalantech try something like this

http://www.reeftalk.com/ubbthreads/dosea...st&Limit=25

All_Forums works fine for me and the displaytype=last as well.
Posted By: VWDerf Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/30/2003 9:05 PM
Ok, I went and reapplied all that stuff (missed some) and it looks a lot better. The only thing that isn't right now is the body preview... Any ideas on fixing this up? I guess this would involve a lot of new queries?

PS, here is a current sample on reeftalk:
http://www.reeftalk.com/ubbthreads/dosea...&bodyprev=1

It displays a preview of the first topic and not the last.
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/30/2003 9:13 PM
Yes with Ricks fixes the first is the one displayed.
Posted By: VWDerf Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/30/2003 9:31 PM
Any way to get it working "properly"? Ie display the teaser or the "last post"? It really confuses people when the teaser doesn't apply the the post in question.
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/30/2003 11:23 PM
So far no. The link is correct but all the ways people have come up with can kill servers as it would have to scan the entire post table to get the true lastpost. That is in essense what I did to get it to truly work. I added a left join on the post table to scan again and compare and get the last post but as you saw that on busier sites was a killer.
Posted By: VWDerf Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/31/2003 1:15 AM
[]Omegatron said:
So far no. The link is correct but all the ways people have come up with can kill servers as it would have to scan the entire post table to get the true lastpost. That is in essense what I did to get it to truly work. I added a left join on the post table to scan again and compare and get the last post but as you saw that on busier sites was a killer. [/]

ya, this is the killer I am running up against. My users absolutly love the last post thing, but you are right, it is killing my board. I'm going to try without a preview for a few days and see how it works.

I guess the other thing to do would be to have a cron drive a query and update a table every 5 minutes with the proper data and just have it retrieved from there.
Fred
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 12/31/2003 3:32 AM
If you do a cron task every 5 minutes you will really kill your server worse. Usually on a cron task everything else on your server shuts down until the cron is over.
I've got it showing the preview of the latest post - a sorta "active topics" deal, but I can't tell if it's gonna kill things. How do I tell?


This is what I have for the page:
Generated in 0.051 seconds in which 0.006 seconds were spent on a total of 11 queries. Zlib compression enabled.
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 01/17/2004 3:47 PM
The search mod already has the ability to preview body. changing the body to the last post body should just be a query change to grab the lastpost body instead of main post.
Okay cool, well I'm just gonna use it then, cause it works. If it kills things, I'll take it down.

I guess I didn't understand stuff in this thread then...nevermind!
Posted By: Zarzal Re: Beta-[6.4] Yet Another Search Mod 2.0 - 01/17/2004 11:45 PM
This new YASM dosn't work with 6.4.1
There are differences in the new selects and changes in the original dosearch.php
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 01/18/2004 12:00 AM
This mod works fine with 6.4.1. Go to my forums and search

The main change in 6.4.1 was to place a selected="selected" statement in the search template which by default only shows posts from the last week. Now if you broaden the search paramter you will find it works very well. I get all main posts and last posts in the time frame I select. So I dont know what your doing wrong.
Posted By: Zarzal Re: Beta-[6.4] Yet Another Search Mod 2.0 - 01/18/2004 12:14 AM
I try two times to hack. dosearch.php give me an error in line 487 after try. In your instructions you write:

## Change this:

$query ="
SELECT t1.B_Number,t1.B_Main,t3.U_Username,t1.B_Subject,t1.B_Posted,t1.B_Board,t3.U_Color,t1.B_Reged,t1.B_Icon,t2.Bo_Title,t2.Bo_Read_Perm,t2.Bo_Cat,t1.B_Posterid,t1.B_Status,t1.B_AnonName,t1.B_Body

but in 6.4.1 the select looks like:

SELECT t1.B_Number,t1.B_Main,t3.U_Username,t1.B_Subject,t1.B_Posted,t1.B_Board,t3.U_Color,t1.B_Reged,t1.B_Icon,t1.B_Posterid,t1.B_Status,t1.B_AnonName,t1.B_Body


I try to remove t2.Bo_Title,t2.Bo_Read_Perm,t2.Bo_Cat from the hack but this dosnt work too. There must be something different.
Posted By: Zarzal Re: Beta-[6.4] Yet Another Search Mod 2.0 - 01/18/2004 12:20 AM
The error message i get every time:
Parse error: parse error, unexpected T_ELSE in /home/www/web17/html/dclan/ubbthreads/dosearch.php on line 486
Posted By: Zarzal Re: Beta-[6.4] Yet Another Search Mod 2.0 - 01/18/2004 12:28 AM
Ok, found it. There is a missing } in your instructions:

## Change This:


if ($Reged == "y") {
$Userlink = "<a href="{$config['phpurl']}/showprofile.php?Cat=$Cat&User=$posterid&what=search&Forum=$forumlist&Words=$URLWords&Searchpage=$Searchpage&Limit=$Limit&where=$where&Name=$Name&daterange=$daterange&newerval=$newerval&newertype=$newertype&olderval=$olderval&oldertype=$oldertype&bodyprev=$bodyprev">$PUsername</a>";
}


## to this:


if ($Reged == "y" && $displaytype == "last") {
$Userlink = "<a href="{$config['phpurl']}/showprofile.php?Cat=$Cat&User=$LastPosterId&what=search&Forum=$forumlist&Words=$URLWords&Searchpage=$Searchpage&Limit=$Limit&where=$where&Name=$Name&daterange=$daterange&newerval=$newerval&newertype=$newertype&olderval=$olderval&oldertype=$oldertype&bodyprev=$bodyprev">$PUsername</a>";
}
elseif ($Reged == "y") {
$Userlink = "<a href="{$config['phpurl']}/showprofile.php?Cat=$Cat&User=$posterid&what=search&Forum=$forumlist&Words=$URLWords&Searchpage=$Searchpage&Limit=$Limit&where=$where&Name=$Name&daterange=$daterange&newerval=$newerval&newertype=$newertype&olderval=$olderval&oldertype=$oldertype&bodyprev=$bodyprev">$PUsername</a>";
}
Posted By: omegatron Re: Beta-[6.4] Yet Another Search Mod 2.0 - 01/18/2004 3:07 AM
HMM well let me check again.

UPDATE.

Instructions updated. 1-16-04 to work with 6.4.1
Posted By: Zarzal Re: Beta-[6.4] Yet Another Search Mod 2.0 - 01/18/2004 9:08 PM
yes, works fine
© UBB.Developers