本文整理汇总了PHP中entryFilter::addSearchMatchToCriteria方法的典型用法代码示例。如果您正苦于以下问题:PHP entryFilter::addSearchMatchToCriteria方法的具体用法?PHP entryFilter::addSearchMatchToCriteria怎么用?PHP entryFilter::addSearchMatchToCriteria使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entryFilter
的用法示例。
在下文中一共展示了entryFilter::addSearchMatchToCriteria方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchMedia
/**
return array('status' => $status, 'message' => $message, 'objects' => $objects);
objects - array of
'thumb'
'title'
'description'
'id' - unique id to be passed to getMediaInfo
*/
public function searchMedia($media_type, $searchText, $page, $pageSize, $authData = null, $extraData = null)
{
$page_size = $pageSize > 20 ? 20 : $pageSize;
$page--;
if ($page < 0) {
$page = 0;
}
$status = "ok";
$message = '';
$objects = array();
$should_serach = true;
if (defined("KALTURA_API_V3")) {
$kuser = kuserPeer::getKuserByPartnerAndUid(self::$partner_id, self::$puser_id);
$should_serach = true;
$kuser_id = $kuser->getId();
} else {
$puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid(self::$partner_id, self::$subp_id, self::$puser_id, true);
if (!$puser_kuser) {
// very bad - does not exist in system
$should_serach = false;
} else {
$kuser = $puser_kuser->getKuser();
if (!$kuser) {
$should_serach = false;
} else {
$kuser_id = $kuser->getId();
}
}
}
// echo "[" . self::$partner_id . "],[". self::$subp_id . "],[" . self::$puser_id . "],[$kuser_id]";
if ($should_serach) {
$c = KalturaCriteria::create(entryPeer::OM_CLASS);
$c->add(entryPeer::KUSER_ID, $kuser_id);
$c->add(entryPeer::MEDIA_TYPE, $media_type);
$c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
// $keywords_array = mySearchUtils::getKeywordsFromStr ( $searchText );
$filter = new entryFilter();
$filter->setPartnerSearchScope(self::$partner_id);
$filter->addSearchMatchToCriteria($c, $searchText, entry::getSearchableColumnName());
$c->setLimit($pageSize);
$c->setOffset($page * $pageSize);
$entry_results = entryPeer::doSelect($c);
//JoinAll( $c );
$number_of_results = $c->getRecordsCount();
$number_of_pages = (int) ($number_of_results / $pageSize);
if ($number_of_results % $pageSize != 0) {
$number_of_pages += 1;
}
// if there are some left-overs - there must be a nother page
// add thumbs when not image or video
$should_add_thumbs = $media_type != entry::ENTRY_MEDIA_TYPE_AUDIO;
foreach ($entry_results as $entry) {
// send the id as the url
$object = array("id" => $entry->getId(), "url" => $entry->getDataUrl(), "tags" => $entry->getTags(), "title" => $entry->getName(), "description" => $entry->getDescription());
if ($should_add_thumbs) {
$object["thumb"] = $entry->getThumbnailUrl();
}
$objects[] = $object;
}
}
return array('status' => $status, 'message' => $message, 'objects' => $objects, "needMediaInfo" => self::$NEED_MEDIA_INFO);
}