i found that 'php' is also supported.
<?php
$solr_server = array
(
'hostname' => $solr_hostname,
'port' => $solr_port,
'path' => $solr_path,
);
$solr_client = new SolrClient($solr_server);
$solr_response_writer = 'php'; $solr_client->setResponseWriter($solr_response_writer);
$solr_response = new SolrObject();
$solr_query = new SolrQuery();
$solr_query->setQuery($solr_query_string); try {
$query_response = $solr_client->query($solr_query);
$solr_response = $query_response->getResponse();
return '';
} catch (Exception $e) {
return ($e);
}
?>
php_error.log keeps on saying:
[12-Aug-2015 12:34:56 Asia/Hong_Kong] PHP Warning: SolrClient::setResponseWriter(): Unsupported response writer php. This value will be ignored in C:\www\...\solr.php on line 21
but the returned data is good as expected:
<?php
$html .= '<table cellSpacing="1" cellPadding="1" border="1">';
$html .= '<tr>';
$html .= '<td>id</td>';
$html .= '<td>title</td>';
$html .= '<td>score</td>';
$html .= '</tr>';
for ($i_solr = 0; $i_solr <= ($solr_rows - 1); $i_solr++) {
$html .= '<tr>';
$html .= '<td>' . $solr_response['response']['docs'][$i_solr]['id'] . '</td>';
$html .= '<td>' . $solr_response['response']['docs'][$i_solr]['title'][0] . '</td>';
$html .= '<td>' . $solr_response['response']['docs'][$i_solr]['score'] . '</td>';
$html .= '</tr>';
}
$html .= '</table>';
echo $html;
?>