當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Data::search方法代碼示例

本文整理匯總了PHP中Data::search方法的典型用法代碼示例。如果您正苦於以下問題:PHP Data::search方法的具體用法?PHP Data::search怎麽用?PHP Data::search使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Data的用法示例。


在下文中一共展示了Data::search方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: search

 /**
  * @brief Search in the activities and return search results
  * @param $query
  * @return search results
  */
 function search($query)
 {
     $data = Data::search($query, 100);
     $results = array();
     foreach ($data as $d) {
         $file = $d['file'];
         $results[] = new \OC_Search_Result(basename($file), $d['subject'] . ' (' . \OCP\Util::formatDate($d['timestamp']) . ')', \OC_Helper::linkTo('activity', 'index.php'), 'Activity');
     }
     return $results;
 }
開發者ID:omusico,項目名稱:isle-web-framework,代碼行數:15,代碼來源:search.php

示例2: keywordAction

 public function keywordAction()
 {
     // Action parameters
     $search = $this->getRequest()->getParam("search");
     // A bit of filtering
     $search = substr($search, 0, 50);
     // Get all the items; if we are an admin, we also get the hidden one
     $data = new Data();
     $sourcesTable = new Sources();
     $sources = $sourcesTable->getSources();
     $items = array();
     foreach ($sources as $source) {
         $s = SourceModel::newInstance($source['service'], $source);
         $index = $s->getSearchIndex();
         $prefix = $s->getServicePrefix();
         $id = $s->getID();
         if ($index != '') {
             $r = $data->search($id, $prefix, $index, $search, $this->_admin);
             if ($r) {
                 $items = array_merge($items, $r);
             }
         }
     }
     // Sort the result of the search
     $sorter = new Stuffpress_SortItems();
     $sorter->sort($items, 1);
     // Prepare the common elements
     $this->common();
     // Add specifics entries
     $this->view->search = $search;
     $this->view->items = $items;
     $this->view->models = $this->getModels();
     // Set page title
     $title = $this->_properties->getProperty('title');
     $subtitle = $this->_properties->getProperty('subtitle');
     $separator = $title ? "|" : "";
     $this->view->headTitle("{$title} {$separator} Search results for {$search}");
     // Add specific styles and javascripts
     $this->view->headScript()->appendFile('js/controllers/timeline.js');
     $this->view->headLink()->appendStylesheet('style/lightbox.css');
     // Render the index
     $this->render('index');
 }
開發者ID:kreativmind,項目名稱:storytlr,代碼行數:43,代碼來源:SearchController.php

示例3: getTopics

 public function getTopics($count, $offset)
 {
     return $this->dataModel->search($this->request, $count, $offset);
 }
開發者ID:zoidbergthepopularone,項目名稱:fitak,代碼行數:4,代碼來源:SearchDataSource.php

示例4: searchAction

 public function searchAction()
 {
     // Action parameters
     $search = $this->getRequest()->getParam("search");
     $output = $this->getRequest()->getParam("output");
     // A bit of filtering
     $search = substr($search, 0, 50);
     // Get all the items; if we are an admin, we also get the hidden one
     $data = new Data();
     $sourcesTable = new Sources();
     $sources = $sourcesTable->getSources();
     $items = array();
     foreach ($sources as $source) {
         $s = SourceModel::newInstance($source['service'], $source);
         $index = $s->getSearchIndex();
         $prefix = $s->getServicePrefix();
         $id = $s->getID();
         if ($index != '') {
             $r = $data->search($id, $prefix, $index, $search, $this->_admin);
             if ($r) {
                 $items = array_merge($items, $r);
             }
         }
     }
     // Sort the result of the search
     $sorter = new Stuffpress_SortItems();
     $sorter->sort($items, 1);
     // Set page title
     $title = $this->_properties->getProperty('title');
     $subtitle = $this->_properties->getProperty('subtitle');
     $separator = $title ? "|" : "";
     $page_title = "{$title} {$separator} Search results for {$search}";
     $this->view->headTitle($page_title);
     // If rss, we stop here
     //		if ($output == "rss") {
     //			$key = "search_$search";
     //			$this->generateRss($key, $items, $page_title);
     //		}
     // Prepare the common elements
     $this->common();
     // Add specifics entries
     $this->view->search = $search;
     $this->view->items = $items;
     $this->view->models = $this->getModels();
     // Add specific styles and javascripts
     $this->view->headScript()->appendFile('js/controllers/timeline.js');
     $this->view->headLink()->appendStylesheet('style/lightbox.css');
     // Set link to RSS of page
     //		$host 		= trim(Zend_Registry::get("host"), '/');
     //		$rss_link   = "http://$host/search/" . urlencode($search) . "?output=rss";
     //		$this->view->headLink()->appendAlternate($rss_link, "application/rss+xml", "RSS Stream");
     // Render the index
     $this->render('index');
 }
開發者ID:kreativmind,項目名稱:storytlr,代碼行數:54,代碼來源:TimelineController.php


注:本文中的Data::search方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。