PHP - Manual: SolrQuery::addGroupSortField
2024-12-21
(PECL solr >= 2.2.0)
SolrQuery::addGroupSortField — Add a group sort field (group.sort parameter)
Allow sorting group documents, using group sort field (group.sort parameter).
field
Field name
order
Order ASC/DESC, utilizes SolrQuery::ORDER_* constants
示例 #1 SolrQuery::addGroupSortField() example
<?php
$solrQuery = new SolrQuery('*:*');
$solrQuery
->setGroup(true)
->addGroupSortField('price', SolrQuery::ORDER_ASC);
echo $solrQuery;
?>
以上例程的输出类似于:
q=*:*&group=true&group.sort=price asc
官方地址:https://www.php.net/manual/en/solrquery.addgroupsortfield.php