. * * @category Stream * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ if (!defined('GNUSOCIAL')) { exit(1); } /** * Stream of notice search results * * @category General * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ class SearchNoticeStream extends ScopingNoticeStream { function __construct($q, Profile $scoped=null) { parent::__construct(new RawSearchNoticeStream($q), $scoped); } } class RawSearchNoticeStream extends NoticeStream { protected $q; function __construct($q) { $this->q = $q; } function getNoticeIds($offset, $limit, $since_id, $max_id) { $notice = new Notice(); $search_engine = $notice->getSearchEngine('notice'); $search_engine->set_sort_mode('chron'); $search_engine->limit($offset, $limit); $ids = array(); // wtf? $search_engine->query($this->q); if ($notice->find()) { while ($notice->fetch()) { $ids[] = $notice->id; } } return $ids; } }