本文整理汇总了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;
}
示例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');
}
示例3: getTopics
public function getTopics($count, $offset)
{
return $this->dataModel->search($this->request, $count, $offset);
}
示例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');
}