summaryrefslogtreecommitdiff
path: root/actions/noticesearchrss.php
diff options
context:
space:
mode:
authorJeffery To <jeffery.to@gmail.com>2009-06-14 16:39:31 +0800
committerJeffery To <jeffery.to@gmail.com>2009-06-14 16:39:31 +0800
commitf7d488d4b2bfdc8dfa6b5a2bc2931dbf824509a0 (patch)
tree556bebe3785cd5e98320af8a59a119d442ec8810 /actions/noticesearchrss.php
parent77c94c44a622052366dcc03fee522232672d71d9 (diff)
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.
Diffstat (limited to 'actions/noticesearchrss.php')
-rw-r--r--actions/noticesearchrss.php13
1 files changed, 9 insertions, 4 deletions
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;