X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Ftwitapisearchjson.php;h=b5c006aa7b9f85f86463b30e9cb61dbcbccc54f6;hb=2882e40540b6ca0aaeb7b9e1841622cf0442ae3d;hp=b50aa86b7ac119a2200d0522671660fc4f50cabe;hpb=13c183e2f4e0738233658ca79103bbe4a6d57992;p=quix0rs-gnu-social.git diff --git a/actions/twitapisearchjson.php b/actions/twitapisearchjson.php index b50aa86b7a..b5c006aa7b 100644 --- a/actions/twitapisearchjson.php +++ b/actions/twitapisearchjson.php @@ -1,8 +1,8 @@ . * * @category Search - * @package Laconica - * @author Zach Copley - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Zach Copley + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; require_once INSTALLDIR.'/lib/jsonsearchresultslist.php'; /** * Action handler for Twitter-compatible API search * * @category Search - * @package Laconica - * @author Zach Copley + * @package StatusNet + * @author Zach Copley * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ - * @see TwitterapiAction + * @link http://status.net/ + * @see ApiAction */ -class TwitapisearchjsonAction extends TwitterapiAction +class TwitapisearchjsonAction extends ApiAction { var $query; var $lang; @@ -114,36 +113,39 @@ class TwitapisearchjsonAction extends TwitterapiAction function showResults() { - // TODO: Support search operators like from: and to: + // TODO: Support search operators like from: and to:, boolean, etc. $notice = new Notice(); // lcase it for comparison $q = strtolower($this->query); - $search_engine = $notice->getSearchEngine('identica_notices'); + $search_engine = $notice->getSearchEngine('notice'); $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 $results = new JSONSearchResultsList($notice, $q, $this->rpp, $this->page); - $this->init_document('json'); + $this->initDocument('json'); $results->show(); - $this->end_document('json'); + $this->endDocument('json'); } /** - * This is a read-only action + * Do we need to write to the database? * * @return boolean true */ - function isReadOnly() + function isReadOnly($args) { return true; } -} \ No newline at end of file +}