In the past, I used this code to count the number of results for a search or for archives:
preg_match('#FROM (.*) GROUP BY#', $request, $matches);
$fromwhere = $matches;
$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
if (0 < $numposts) $numposts = number_format($numposts);
In the past with an older version of the Semiologic Search Reloaded plugin it worked absolutely fine.
I have recently upgraded to WordPress 2.0.x & the latest version of the Search Reloaded plugin - & now my code thinks that it finds 0 results, no matter how many there are.
If I disable Search Reloaded it works fine once more. It also works fine for other types of archive pages, just not for search.
Does anyone have any suggestions for what I need to change in my code to make it work again?