SolrClient::ping
SolrClient::request
SolrClient
PHP Manual

# SolrClient::query

(PECL solr >= 0.9.2)

SolrClient::query — Sends a query to the server

### 説明

public SolrQueryResponse SolrClient::query ( SolrParams `$query` )

Sends a query to the server.

### パラメータ

`query`

  A SolrParam object. It is recommended to use SolrQuery for advanced queries.

### 返り値

Returns a SolrQueryResponse object on success and throws a SolrClientException object on failure.

### 例

例1 SolrClient::query example

`<?php
include "bootstrap.php";
$options = array
(
'hostname' => 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);
?>`

上の例の出力は、 たとえば以下のようになります。

SolrClient::ping
SolrClient::request
SolrClient
PHP Manual