2009-12-30, 03:53 AM
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
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;
}