'*:*', 'start' => 2, 'rows' => 20, 'fields' => array('id','name','price'), 'sort' => array('price' => 'asc'), 'filterquery' => array( 'maxprice' => array( 'query' => 'price:[1 TO 300]' ), ), 'component' => array( 'facetset' => array( 'facet' => array( // notice this config uses an inline key value, instead of array key like the filterquery array('type' => 'field', 'key' => 'stock', 'field' => 'inStock'), ) ), ), ); // create a client instance $client = new Solarium_Client($config); // get a select query instance based on the config $query = $client->createSelect($select); // this executes the query and returns the result $resultset = $client->select($query); // display the total number of documents found by solr echo 'NumFound: '.$resultset->getNumFound(); // display facet counts echo '
Facet counts for field "inStock":
'; $facet = $resultset->getFacetSet()->getFacet('stock'); foreach($facet as $value => $count) { echo $value . ' [' . $count . ']
'; } // show documents using the resultset iterator foreach ($resultset as $document) { echo '
'; echo ''; echo ''; echo ''; echo '
id' . $document->id . '
name' . $document->name . '
price' . $document->price . '
'; } htmlFooter();