createSelect(); $query->setQuery('memory'); // get highlighting component and apply settings // highlights are applied to three fields with a different markup for each field // much more per-field settings are available, see the manual for all options $hl = $query->getHighlighting(); $hl->getField('name')->setSimplePrefix('')->setSimplePostfix(''); $hl->getField('cat')->setSimplePrefix('')->setSimplePostfix(''); $hl->getField('features')->setSimplePrefix('')->setSimplePostfix(''); // this executes the query and returns the result $resultset = $client->select($query); $highlighting = $resultset->getHighlighting(); // display the total number of documents found by solr echo 'NumFound: '.$resultset->getNumFound(); // show documents using the resultset iterator foreach ($resultset as $document) { echo '
' . $field . ' | ' . $value . ' |
---|