本文整理汇总了PHP中SphinxClient::setGroupBy方法的典型用法代码示例。如果您正苦于以下问题:PHP SphinxClient::setGroupBy方法的具体用法?PHP SphinxClient::setGroupBy怎么用?PHP SphinxClient::setGroupBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SphinxClient
的用法示例。
在下文中一共展示了SphinxClient::setGroupBy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setGroupBy
/**
* Group results by an attribute.
*
* @param string $attribute The name of the attribute.
* @param int $func Constant, applied to attribute value, one of the SPH_GROUPBY_ constants.
* @param string $groupsort An optional clause controlling how the groups are sorted.
*/
public function setGroupBy($attribute, $func, $groupsort = "@group desc")
{
$this->sphinx->setGroupBy($attribute, $func, $groupsort);
}
示例2: groupby
/**
* @brief set grouping attribute and function, SQL-like syntax - 'group_by'
* @param array $groupby
* @return $this chain
*/
public function groupby($groupby = null)
{
$this->criteria->groupby = $groupby;
// set groupby
if ($groupby && is_array($groupby)) {
$this->client->setGroupBy($groupby['field'], $groupby['mode'], $groupby['order']);
}
return $this;
}
示例3: elseif
} elseif (!$fids) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
if ($_G['adminid'] != '1' && $_G['setting']['search']['forum']['maxspm']) {
if (DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_searchindex') . " WHERE srchmod='{$srchmod}' AND dateline>'{$_G['timestamp']}'-60") >= $_G['setting']['search']['forum']['maxspm']) {
showmessage('search_toomany', 'search.php?mod=forum', array('maxspm' => $_G['setting']['search']['forum']['maxspm']));
}
}
if ($srchtype == 'fulltext' && $_G['setting']['sphinxon']) {
require_once libfile('class/sphinx');
$s = new SphinxClient();
$s->setServer($_G['setting']['sphinxhost'], intval($_G['setting']['sphinxport']));
$s->setMaxQueryTime(intval($_G['setting']['sphinxmaxquerytime']));
$s->SetRankingMode($_G['setting']['sphinxrank']);
$s->setLimits(0, intval($_G['setting']['sphinxlimit']), intval($_G['setting']['sphinxlimit']));
$s->setGroupBy('tid', SPH_GROUPBY_ATTR);
if ($srchfilter == 'digest') {
$s->setFilterRange('digest', 1, 3, false);
}
if ($srchfilter == 'top') {
$s->setFilterRange('displayorder', 1, 2, false);
} else {
$s->setFilterRange('displayorder', 0, 2, false);
}
if (!empty($srchfrom) && empty($srchtxt) && empty($srchuid) && empty($srchuname)) {
$expiration = TIMESTAMP + $cachelife_time;
$keywords = '';
if ($before) {
$spx_timemix = 0;
$spx_timemax = TIMESTAMP - $srchfrom;
} else {
示例4: bindToSphinx
/**
* @param \SphinxClient $sphinx
*/
public function bindToSphinx(\SphinxClient $sphinx)
{
$sphinx->setGroupBy($this->getAttr(), $this->getFunc(), $this->getGroupBy());
}