Without looking at it at depth, I think the following would work. Edit your search.php file with the following changes. Be sure to back up your search.php file before doing this, so if it doesn't work right, you can revert to the regular version.
Warning: this code is untested.
First define a phrase called searchrefinequery with your error message, maybe: "Your search returned gazillions of posts, try being more specific, thanks".
Also, change the number 1000 to whatever suits your fancy.
(1)
Add this:
PHP Code:
if (count ($ANDs) > 1000)
{
eval(standard_error(fetch_error('searchrefinequery')));
}
Right before this on line 1050:
PHP Code:
$post_query_logic[100] = 'post.postid IN(' . implode(',', $ANDs) . ')';
(2)
Add this:
PHP Code:
if (count ($postids) > 1000)
{
eval(standard_error(fetch_error('searchrefinequery')));
}
Right before this on line 1123:
PHP Code:
$post_query_logic[] = 'post.postid IN(' . implode(',', $postids) . ')';
(3)
Add this:
PHP Code:
if (count ($requiredposts) > 1000)
{
eval(standard_error(fetch_error('searchrefinequery')));
}
Right before this on line 1296:
PHP Code:
$post_query_logic[] = "post.postid IN(" . implode(',', $requiredposts) . ")";