SolrClient::query
Sends a query to the server
&reftitle.description;
public SolrQueryResponseSolrClient::query
SolrParamsquery
Sends a query to the server.
&reftitle.parameters;
query
A SolrParam object. It is recommended to use SolrQuery for advanced queries.
&reftitle.returnvalues;
Returns a SolrQueryResponse object on success and throws a SolrClientException object on failure.
&reftitle.examples;
SolrClient::query example
SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'password' => SOLR_SERVER_PASSWORD,
'port' => SOLR_SERVER_PORT,
);
$client = new SolrClient($options);
$query = new SolrQuery();
$query->setQuery('lucene');
$query->setStart(0);
$query->setRows(50);
$query->addField('cat')->addField('features')->addField('id')->addField('timestamp');
$query_response = $client->query($query);
$response = $query_response->getResponse();
print_r($response);
?>
]]>
&example.outputs.similar;