diff options
Diffstat (limited to 'actions')
-rw-r--r-- | actions/noticesearchrss.php | 13 | ||||
-rw-r--r-- | actions/twitapisearchatom.php | 27 | ||||
-rw-r--r-- | actions/twitapisearchjson.php | 9 |
3 files changed, 31 insertions, 18 deletions
diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php index c1bf3bf5f..2a4b2060d 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; diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php index eb9ab5d8e..708b1494d 100644 --- a/actions/twitapisearchatom.php +++ b/actions/twitapisearchatom.php @@ -165,24 +165,29 @@ class TwitapisearchatomAction extends TwitterapiAction $search_engine->set_sort_mode('chron'); $search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1, true); - $search_engine->query($q); - $this->cnt = $notice->find(); + if (false === $search_engine->query($q)) { + $this->cnt = 0; + } else { + $this->cnt = $notice->find(); + } $cnt = 0; - while ($notice->fetch()) { + if ($this->cnt > 0) { + while ($notice->fetch()) { - ++$cnt; + ++$cnt; - if (!$this->max_id) { - $this->max_id = $notice->id; - } + if (!$this->max_id) { + $this->max_id = $notice->id; + } - if ($cnt > $this->rpp) { - break; - } + if ($cnt > $this->rpp) { + break; + } - $notices[] = clone($notice); + $notices[] = clone($notice); + } } return $notices; diff --git a/actions/twitapisearchjson.php b/actions/twitapisearchjson.php index b0e3be687..27a717bfc 100644 --- a/actions/twitapisearchjson.php +++ b/actions/twitapisearchjson.php @@ -124,8 +124,11 @@ class TwitapisearchjsonAction extends TwitterapiAction $search_engine = $notice->getSearchEngine('identica_notices'); $search_engine->set_sort_mode('chron'); $search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1, true); - $search_engine->query($q); - $cnt = $notice->find(); + if (false === $search_engine->query($q)) { + $cnt = 0; + } else { + $cnt = $notice->find(); + } // TODO: since_id, lang, geocode @@ -146,4 +149,4 @@ class TwitapisearchjsonAction extends TwitterapiAction { return true; } -}
\ No newline at end of file +} |