MyBB Community Forums

Full Version: Search hard limit ignores dates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If you enable the hard limit feature in the search settings, the results always return the oldest posts. My board has over 1 million posts and I have been using the hard limit recommended value of 1000 for performance reasons.

However, this causes an issue...

When someone wants to search for posts OR threads by a user without any search terms (e.g find all posts), regardless of how the search sort order is specified, the search uses a simple LIMIT statement, ignoring any date option, thus only old posts/threads are pulled since the default table order is on tid/pid/dateline. When a user has over 1,000 posts or threads started their new stuff is ignored.

It would be nice if the default {$limitsql} variable included an 'ORDER BY dateline DESC' unless the user selected 'sort results by last post date' AND chooses 'Ascending' order.

This way, the initial thread and post select queries (search.php, lines 266, 288, 649, ver 1.4.9) pulls tids/pids of newer threads/posts by default unless specifically told to pull older stuff.
It looks like a simple fix, line 135 (again ver 1.4.9) add the following code
	if($search['resulttype'] == "threads")
	{
		$limitsql = "ORDER BY lastpost ".$order." ".$limitsql;
	}
	else
	{
		$limitsql = "ORDER BY dateline ".$order." ".$limitsql;
	}
This was fixed I believe already in 1.4.10. Do you have the latest MyBB?
not yet, i skipped 1.4.10 as the changes did not impact me. have not upgraded to 1.4.11, waiting a few days for any bugs to surface. then i need to compare my modded core files to the new files (my drive with my mods vs originals dies so i need to run a compare on them all again)
This is fixed then in 1.4.10 pretty sure. I was the guy that bug reported it. Try it at Hackforums.net to see it's fixed.

Realistically 1.4.10 was a huge maintenance release. Before reporting bugs make sure you have latest version.
(2009-12-30, 06:20 AM)labrocca Wrote: [ -> ]Before reporting bugs make sure you have latest version.

True, saves both you and us time, plus 1.4.11 has security fixes so you don't really want to be hanging around on 1.4.9 for too much longer.
sorry, i did not see the fix listed on this page: http://blog.mybboard.net/2009/12/01/mybb...e-release/ so i posted the report.

also, the fix i posted only work on searches from the search page, not from the Find All Thread or Find All Posts from the user profile (which seemed to be listed in the bug fixes).

I will upgrade to 1.4.11 today if I can get the time.