createSelect(); // get the facetset component $facetSet = $query->getFacetSet(); // create a facet query instance and set options $facetSet->createFacetQuery('stock')->setQuery('inStock: true'); // 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 query count $count = $resultset->getFacetSet()->getFacet('stock')->getValue(); echo '
Facet query count : ' . $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();