UBB.Dev
I discussed this in another post, but thought I would ask it in it's own thread.

Is there a way to set up the search and active topics results to show relavent THREADS instead of the relavant POSTS? I understand that this is actually taking a step back, so to speak, as the current way of doing it is more specific, and takes you to the exact post in question. But, on larger sites, these 2 searches can get quite "lengthy".

Now, let me get greedy : possibly set it up to toggle between the 2 options, from the admin area?
This would be nice indeed.
I guess one problem there would be, maybe server resource eater, is that besides searching for all those posts, then getting the thread (for displaying thread instead of posts) would not be enough as long as you dont also link to the specific page in the post. That is, once it is converted to a thread link, it should also calculate to what page it should go (1,2,3,4,5,6)and the specific first unread post (#135484123). That is, show results like in postlist.php

Unless that is how the feature is improved, I doubt it will be a feature used by hardly anyone. Maybe it should be done even if it takes twice as much to generate the page.

If this feature is improved, it should be done in the complete useful way. If not, it will be an incomplete feature unlikely to be used (as it is now).
My main reason for wanting/needing this change is because most of my users visit pretty much the same few boards, which are car related, and are all running Ubb classic. And, this is how classic handles it's searches. It doesn't show each relevant post, but each relevant thread. And, when a thread is chosen, it doesn't take you to the last post made, but to the beginning of the thread. This sounds a LOT more logical to me, as a person coming along looking for a certian subject, would pick up in the middle (or end) of a discussion, and would thus have to go to the beginning of the thread anyway.
A new person would be taken to the begining as they would have not have the temp read values for the thread stored. (or shouldn't) lol

Then again I'm not sure if I completely understand what the search should do. You wan't to display ONLY the MAIN post and not any replies to the post in the search results?

This could probably be done easily enough with a "AND B_Main = B_Number" in the search query. Putting it in as a user selected option would take more work though.
I'm with ya, Dave, on the first un-read post thing. Hadn't thought of that.

Ok, here's what I would "like". Say I do a search for "xyz" on the normal threads setup. I get back a search showing all individual posts with "xyz" in them. [Example: I start a thread entitled "xyz", and various users reply about said topic.] The results will show my initial topic, and each post, across the board, containing "xyz". {Example: Some replies to my initial post, commenting about "xyz". Thus, the search results display the posts "xyz" and "re: xyz".]

Now, I would like to see the search just show each THREAD containing "xyz". [Example: the "revised" search, using the above examples, would have returned the original thread, "xyz", thus only 1 result.]

As for a user selected option, that's not that necessary. I'm trying to make my board as user friendly as possible, and most of my users are used to "classic"...creatures of habit, I guess! I know, if I wanted classic features, I should have bought classic. Well, I saw the threads software as a lot more powerful, and a lot better to MY liking.
I haven't tried this but in your dosearch.php script find this:

code:

$query ="
SELECT t1.B_Number,t1.B_Main,t1.B_Username,t1.B_Subject,t1.B_Posted,t1.B_Board,t1.B_Color,t1.B_Sticky,t1.B_Reged,t1.B_Icon,t1.B_UStatus,t2.Bo_Title,t2.Bo_Read_Perm,t2.Bo_Cat
FROM w3t_Posts AS t1,
w3t_Boards AS t2
WHERE B_Approved = 'yes'
AND t1.B_Board = t2.Bo_Keyword
";
[/code]


And replace it with this:

code:

$query ="
SELECT t1.B_Number,t1.B_Main,t1.B_Username,t1.B_Subject,t1.B_Posted,t1.B_Board,t1.B_Color,t1.B_Sticky,t1.B_Reged,t1.B_Icon,t1.B_UStatus,t2.Bo_Title,t2.Bo_Read_Perm,t2.Bo_Cat
FROM w3t_Posts AS t1,
w3t_Boards AS t2
WHERE B_Approved = 'yes'
AND B_Main = B_Number
AND t1.B_Board = t2.Bo_Keyword
";
[/code]

This may or may not work. I haven't tried it. I just took a look at the code and gave a guess as to what would accomplish your search.
[:"red"]Bingo[/].
Looks like that did the trick fellas. THANKS!
I can see the use of showing just the initial post of a thread in the search-result, sometimes that can be useful. But doing it this way actually cripples the search, since it never looks in replies so the search would miss all threads where the search string ("xyz") is only in one of the replies.

I've been thinking about a way to get a result with all threads where xyz is in any of the posts, but haven't come up with anything that requires a subquery or two queries. But I won't try anything else unless anyone really wants this functionality.
I agree that searching the main posts only cripples the search. But I guess for those that want to stick to some older UBB habits it will suffice.
Actually, this makes a lot of sense, but only for the recent messages.

Because, when there are 5 messages in the same threads on the past 24 hours search, it's easier to only have to click one link, and not 5... it's just easier.
Let me take back what I just said. If the search is for messages in the past 24 hours, it won't pull any thread with messages in the past 24 hours, of course, but rather just the threads that have been posted in the past 24 hours. Duh!
Well, you guys pretty much stated what I discovered since I changed this last night.

The search and recent messages are only picking up the main post, which is pretty much worthless.

If this is to work, it needs to be set up to SEARCH for new posts/relavent posts, but only DISPLAY the main thread...right? I'm starting to confuse myself...
In your templates directory find your dosearch.tmpl file and change this line:

for ($i=0;$i<$resultsize;$i++) { //UBBTREMARK

to this one:

for ($i=0;$i<$resultsize;$i++) {
if ($searchrow[$i]['Number'] != $searchrow[$i]['Main']) {continue;} //UBBTREMARK



I'm not sure if this will do the trick so let me know what happens.
The problem with that is that if the search doesn't match on the first post of the thread that thread won't show up.

All posts has to be searched, but the search result information has to be taken for the main post of the thread for every hit. I haven't manage to come up with a way of doing this with a single query, but it's possible with two.
Ok so that didn't work then..

I guess two queries would be needed then. Once the original query was made you could format the second query using the board numbers returned from the first and then do the second query looking for where those board numbers matched the main number (this would be the main post then) and using that information for the display.
Why not just make the search results page to be threaded or flat based on user preferences. if it is flat sort it by the thread with the most recient but only show the first post. Instead of the tons of "RE:'s" then perhaps in under the
subject a snipit of the first few hundred characters or so of the most recient reply, and then the 1,2,3,4 etc. with the correct one highlited.
© UBB.Developers