1<?php
2
3include "bootstrap.php";
4
5$options = array
6(
7		'hostname' => SOLR_SERVER_HOSTNAME,
8		'login'    => SOLR_SERVER_USERNAME,
9		'password' => SOLR_SERVER_PASSWORD,
10		'port'     => SOLR_SERVER_PORT,
11		'path'	   => SOLR_SERVER_PATH
12);
13
14$client = new SolrClient($options);
15
16$query = new SolrQuery('*:*');
17
18$func = new SolrCollapseFunction('manu_id_s');
19
20$query->collapse($func);
21
22$query->setExpand(true);
23$query->setExpandRows(10);
24$query->setExpandQuery('manu_id_s:corsair');
25$query->addExpandFilterQuery('inStock:true');
26$query->addExpandSortField('score', SolrQuery::ORDER_DESC);
27
28$queryResponse = $client->query($query);
29
30$response = $queryResponse->getResponse();
31
32print_r($response);
33