createSelect(); // get the facetset component $facetSet = $query->getFacetSet(); // create a facet field instance and set options $facet = $facetSet->createFacetRange('priceranges'); $facet->setField('price'); $facet->setStart(1); $facet->setGap(100); $facet->setEnd(1000); // 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 ranges:
'; $facet = $resultset->getFacetSet()->getFacet('priceranges'); foreach($facet as $range => $count) { echo $range . ' to ' . ($range + 100) . ' [' . $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();