<?php

include "bootstrap.php";
$options = array('hostname' => SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH);
$client = new SolrClient($options);
$query = new SolrQuery('*:*');
$collapseFunction = new SolrCollapseFunction('manu_id_s');
$collapseFunction->setSize(2)->setNullPolicy(SolrCollapseFunction::NULLPOLICY_IGNORE);
// $collapseFunction->setMax('sum(cscore(),field(A))');
$query->collapse($collapseFunction)->setRows(4);
$queryResponse = $client->query($query);
$response = $queryResponse->getResponse();
print_r($response);
<?php

include "bootstrap.php";
$options = array('hostname' => SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH);
$client = new SolrClient($options);
$query = new SolrQuery('*:*');
$func = new SolrCollapseFunction('field_name');
$func->setMax('sum(cscore(),field(A))');
$func->setSize(100);
$func->setNullPolicy(SolrCollapseFunction::NULLPOLICY_EXPAND);
$query->collapse($func);
$queryResponse = $client->query($query);
$response = $queryResponse->getResponse();
print_r($response);