本文整理汇总了PHP中CollectionAttributeKey::getSearchableIndexedList方法的典型用法代码示例。如果您正苦于以下问题:PHP CollectionAttributeKey::getSearchableIndexedList方法的具体用法?PHP CollectionAttributeKey::getSearchableIndexedList怎么用?PHP CollectionAttributeKey::getSearchableIndexedList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CollectionAttributeKey
的用法示例。
在下文中一共展示了CollectionAttributeKey::getSearchableIndexedList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterByKeywords
/**
* Filters by "keywords" (which searches everything including filenames, title, tags, users who uploaded the file, tags)
*/
public function filterByKeywords($keywords, $simple = false) {
$db = Loader::db();
$kw = $db->quote($keywords);
$qk = $db->quote('%' . $keywords . '%');
Loader::model('attribute/categories/collection');
$keys = CollectionAttributeKey::getSearchableIndexedList();
$attribsStr = '';
foreach ($keys as $ak) {
$cnt = $ak->getController();
$attribsStr.=' OR ' . $cnt->searchKeywords($keywords);
}
if ($simple || $this->indexModeSimple) { // $this->indexModeSimple is set by the IndexedPageList class
$this->filter(false, "(psi.cName like $qk or psi.cDescription like $qk or psi.content like $qk {$attribsStr})");
} else {
$this->indexedSearch = true;
$this->indexedKeywords = $keywords;
$this->autoSortColumns[] = 'cIndexScore';
$this->filter(false, "((match(psi.cName, psi.cDescription, psi.content) against ({$kw})) {$attribsStr})");
}
}
示例2: filterByKeywords
/**
* Filters keyword fields by keywords (including name, description, content, and attributes.
*
* @param $keywords
*/
public function filterByKeywords($keywords)
{
$expressions = array($this->query->expr()->like('psi.cName', ':keywords'), $this->query->expr()->like('psi.cDescription', ':keywords'), $this->query->expr()->like('psi.content', ':keywords'));
$keys = \CollectionAttributeKey::getSearchableIndexedList();
foreach ($keys as $ak) {
$cnt = $ak->getController();
$expressions[] = $cnt->searchKeywords($keywords, $this->query);
}
$expr = $this->query->expr();
$this->query->andWhere(call_user_func_array(array($expr, 'orX'), $expressions));
$this->query->setParameter('keywords', '%' . $keywords . '%');
}