12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- 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();
-
- $search_engine->query($this->q);
- if ($notice->find()) {
- while ($notice->fetch()) {
- $ids[] = $notice->id;
- }
- }
- return $ids;
- }
- }
|