当前位置: 首页>>代码示例>>PHP>>正文


PHP Notice::getSearchEngine方法代码示例

本文整理汇总了PHP中Notice::getSearchEngine方法的典型用法代码示例。如果您正苦于以下问题:PHP Notice::getSearchEngine方法的具体用法?PHP Notice::getSearchEngine怎么用?PHP Notice::getSearchEngine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notice的用法示例。


在下文中一共展示了Notice::getSearchEngine方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getNoticeIds

 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;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:16,代码来源:searchnoticestream.php

示例2: getNotices

 function getNotices($limit = 0)
 {
     $q = $this->trimmed('q');
     $notices = array();
     $notice = new Notice();
     $search_engine = $notice->getSearchEngine('identica_notices');
     $search_engine->set_sort_mode('chron');
     if (!$limit) {
         $limit = 20;
     }
     $search_engine->limit(0, $limit, true);
     $search_engine->query($q);
     $notice->find();
     while ($notice->fetch()) {
         $notices[] = clone $notice;
     }
     return $notices;
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:18,代码来源:noticesearchrss.php

示例3: getNotices

 protected function getNotices()
 {
     $q = $this->trimmed('q');
     $notices = array();
     $notice = new Notice();
     $search_engine = $notice->getSearchEngine('notice');
     $search_engine->set_sort_mode('chron');
     $search_engine->limit(0, $this->limit, true);
     if (false === $search_engine->query($q)) {
         $cnt = 0;
     } else {
         $cnt = $notice->find();
     }
     if ($cnt > 0) {
         while ($notice->fetch()) {
             $notices[] = clone $notice;
         }
     }
     return $notices;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:20,代码来源:noticesearchrss.php

示例4: getNotices

 /**
  * Get the notices to output as results. This also sets some class
  * attrs so we can use them to calculate pagination, and output
  * since_id and max_id.
  *
  * @return array an array of Notice objects sorted in reverse chron
  */
 function getNotices()
 {
     // TODO: Support search operators like from: and to:, boolean, etc.
     $notices = array();
     $notice = new Notice();
     // lcase it for comparison
     $q = strtolower($this->query);
     $search_engine = $notice->getSearchEngine('notice');
     $search_engine->set_sort_mode('chron');
     $search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1, true);
     if (false === $search_engine->query($q)) {
         $this->cnt = 0;
     } else {
         $this->cnt = $notice->find();
     }
     $cnt = 0;
     $this->max_id = 0;
     if ($this->cnt > 0) {
         while ($notice->fetch()) {
             ++$cnt;
             if (!$this->max_id) {
                 $this->max_id = $notice->id;
             }
             if ($this->since_id && $notice->id <= $this->since_id) {
                 break;
             }
             if ($cnt > $this->rpp) {
                 break;
             }
             $notices[] = clone $notice;
         }
     }
     return $notices;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:41,代码来源:apisearchatom.php

示例5: showResults

 /**
  * Show results
  *
  * @param string  $q    search query
  * @param integer $page page number
  *
  * @return void
  */
 function showResults($q, $page)
 {
     $notice = new Notice();
     $search_engine = $notice->getSearchEngine('notice');
     $search_engine->set_sort_mode('chron');
     // Ask for an extra to see if there's more.
     $search_engine->limit(($page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
     if (false === $search_engine->query($q)) {
         $cnt = 0;
     } else {
         $cnt = $notice->find();
     }
     if ($cnt === 0) {
         $this->element('p', 'error', _('No results.'));
         $this->searchSuggestions($q);
         if (common_logged_in()) {
             $message = sprintf(_('Be the first to [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), urlencode($q));
         } else {
             $message = sprintf(_('Why not [register an account](%%%%action.register%%%%) and be the first to [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), urlencode($q));
         }
         $this->elementStart('div', 'guide');
         $this->raw(common_markup_to_html($message));
         $this->elementEnd('div');
         return;
     }
     $terms = preg_split('/[\\s,]+/', $q);
     $nl = new SearchNoticeList($notice, $this, $terms);
     $cnt = $nl->show();
     $this->pagination($page > 1, $cnt > NOTICES_PER_PAGE, $page, 'noticesearch', array('q' => $q));
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:38,代码来源:noticesearch.php

示例6: showResults

 /**
  * Show search results
  *
  * @return void
  */
 function showResults()
 {
     // 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('notice');
     $search_engine->set_sort_mode('chron');
     $search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1, true);
     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->initDocument('json');
     $results->show();
     $this->endDocument('json');
 }
开发者ID:himmelex,项目名称:NTW,代码行数:25,代码来源:twitapisearchjson.php

示例7: showResults

 /**
  * Show search results
  *
  * @return void
  */
 function showResults()
 {
     // TODO: Support search operators like from: and to:, boolean, etc.
     $notice = new Notice();
     $this->notices = array();
     $search_engine = $notice->getSearchEngine('notice');
     $search_engine->set_sort_mode('chron');
     $search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1);
     if ($search_engine->query($this->query)) {
         $cnt = $notice->find();
         $this->notices = $notice->fetchAll();
     }
     $this->showJsonTimeline($this->notices);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:19,代码来源:apisearchjson.php

示例8: showResults

 /**
  * Show results
  *
  * @param string  $q    search query
  * @param integer $page page number
  *
  * @return void
  */
 function showResults($q, $page)
 {
     $notice = new Notice();
     $search_engine = $notice->getSearchEngine('identica_notices');
     $search_engine->set_sort_mode('chron');
     // Ask for an extra to see if there's more.
     $search_engine->limit(($page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
     if (false === $search_engine->query($q)) {
         $cnt = 0;
     } else {
         $cnt = $notice->find();
     }
     if ($cnt === 0) {
         $this->element('p', 'error', _('No results'));
         return;
     }
     $terms = preg_split('/[\\s,]+/', $q);
     $nl = new SearchNoticeList($notice, $this, $terms);
     $cnt = $nl->show();
     $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE, $this->page, 'noticesearch', array('q' => $q));
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:29,代码来源:noticesearch.php


注:本文中的Notice::getSearchEngine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。