<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Set grouping attribute</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sphinxclient.setgeoanchor.html">SphinxClient::setGeoAnchor</a></div> <div class="next" style="text-align: right; float: right;"><a href="sphinxclient.setgroupdistinct.html">SphinxClient::setGroupDistinct</a></div> <div class="up"><a href="class.sphinxclient.html">SphinxClient</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="sphinxclient.setgroupby" class="refentry"> <div class="refnamediv"> <h1 class="refname">SphinxClient::setGroupBy</h1> <p class="verinfo">(PECL sphinx >= 0.1.0)</p><p class="refpurpose"><span class="refname">SphinxClient::setGroupBy</span> — <span class="dc-title">Set grouping attribute</span></p> </div> <div class="refsect1 description" id="refsect1-sphinxclient.setgroupby-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><strong>SphinxClient::setGroupBy</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$attribute</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$func</code></span> [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$groupsort</code><span class="initializer"> = "@group desc"</span></span> ] )</div> <p class="para rdfs-comment"> Sets grouping attribute, function, and group sorting mode, and enables grouping. </p> <p class="para"> Grouping feature is very similar to GROUP BY clause in SQL. Results produced by this function call are going to be the same as produced by the following pseudo code: <strong class="command">SELECT ... GROUP BY $func($attribute) ORDER BY $groupsort</strong>. </p> </div> <div class="refsect1 parameters" id="refsect1-sphinxclient.setgroupby-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">attribute</code></em></span> <dd> <p class="para"> A string containing group-by attribute name. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">func</code></em></span> <dd> <p class="para"> Constant, which sets a function applied to the attribute value in order to compute group-by key. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">groupsort</code></em></span> <dd> <p class="para"> An optional clause controlling how the groups are sorted. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-sphinxclient.setgroupby-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 seealso" id="refsect1-sphinxclient.setgroupby-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="sphinxclient.resetgroupby.html" class="xref">SphinxClient::resetGroupBy</a></li> <li class="member"><a href="sphinxclient.setsortmode.html" class="xref">SphinxClient::setSortMode</a></li> <li class="member"><a href="sphinxclient.setgroupdistinct.html" class="xref">SphinxClient::setGroupDistinct</a></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sphinxclient.setgeoanchor.html">SphinxClient::setGeoAnchor</a></div> <div class="next" style="text-align: right; float: right;"><a href="sphinxclient.setgroupdistinct.html">SphinxClient::setGroupDistinct</a></div> <div class="up"><a href="class.sphinxclient.html">SphinxClient</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>