CakeFest 2025 Madrid: The Official CakePHP Conference

SolrQuery::addGroupSortField

(PECL solr >= 2.2.0)

SolrQuery::addGroupSortFieldAdd a group sort field (group.sort parameter)

Description

public SolrQuery::addGroupSortField(string $field, int $order = ?): SolrQuery

Allow sorting group documents, using group sort field (group.sort parameter).

Parameters

field

Field name

order

Order ASC/DESC, utilizes SolrQuery::ORDER_* constants

Return Values

Examples

Example #1 SolrQuery::addGroupSortField() example

<?php

$solrQuery
= new SolrQuery('*:*');
$solrQuery
->setGroup(true)
->
addGroupSortField('price', SolrQuery::ORDER_ASC);

echo
$solrQuery;
?>

The above example will output something similar to:

q=*:*&group=true&group.sort=price asc

See Also

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant