From f7d488d4b2bfdc8dfa6b5a2bc2931dbf824509a0 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Sun, 14 Jun 2009 16:39:31 +0800 Subject: Fixes the notice search RSS feeds / API results for searches that return no matches. If a user does a notice search that should return no matching notices, the RSS feed / API results for that search currently returns all notices instead of no notices. This fixes it so that an empty list is returned instead. --- actions/noticesearchrss.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'actions/noticesearchrss.php') diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php index f6da969ee..94bf6ba30 100644 --- a/actions/noticesearchrss.php +++ b/actions/noticesearchrss.php @@ -67,11 +67,16 @@ class NoticesearchrssAction extends Rss10Action if (!$limit) $limit = 20; $search_engine->limit(0, $limit, true); - $search_engine->query($q); - $notice->find(); + if (false === $search_engine->query($q)) { + $cnt = 0; + } else { + $cnt = $notice->find(); + } - while ($notice->fetch()) { - $notices[] = clone($notice); + if ($cnt > 0) { + while ($notice->fetch()) { + $notices[] = clone($notice); + } } return $notices; -- cgit v1.2.3-54-g00ecf