createSelect(); // get the facetset component $facetSet = $query->getFacetSet(); // create a facet query instance and set options $facet = $facetSet->createFacetMultiQuery('stock'); $facet->createQuery('stock_pricecat1', 'inStock:true AND price:[1 TO 300]'); $facet->createQuery('nostock_pricecat1', 'inStock:false AND price:[1 TO 300]'); $facet->createQuery('stock_pricecat2', 'inStock:true AND price:[300 TO *]'); $facet->createQuery('nostock_pricecat2', 'inStock:false AND price:[300 TO *]'); // 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 '
id | ' . $document->id . ' |
---|---|
name | ' . $document->name . ' |
price | ' . $document->price . ' |