PHP Doku:: Sets the response writer used to prepare the response from Solr - solrclient.setresponsewriter.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSuchmaschinenerweiterungenApache SolrThe SolrClient classSolrClient::setResponseWriter

Ein Service von Reinhard Neidl - Webprogrammierung.

The SolrClient class

<<SolrClient::rollback

SolrClient::setServlet>>

SolrClient::setResponseWriter

(PECL solr >= 0.9.11)

SolrClient::setResponseWriterSets the response writer used to prepare the response from Solr

Beschreibung

public void SolrClient::setResponseWriter ( string $responseWriter )

Sets the response writer used to prepare the response from Solr

Parameter-Liste

responseWriter

One of the following :

- xml
 - phpnative

Rückgabewerte

Es wird kein Wert zurückgegeben.

Beispiele

Beispiel #1 SolrClient::setResponseWriter() example

<?php

// This is my custom class for objects
class SolrClass
{
   public 
$_properties = array();

   public function 
__get($property_name) {
      
      if (
property_exists($this$property_name)) {
      
          return 
$this->$property_name;
      
      } else if (isset(
$_properties[$property_name])) {
      
          return 
$_properties[$property_name];
      }
      
      return 
null;
   }
}

$options = array
(
  
'hostname' => 'localhost',
  
'port' => 8983,
  
'path' => '/solr/core1'
);

$client = new SolrClient($options);

// This uses the org.apache.solr.request.PHPNativeResponseWriter class on Solr
// Visit the following pages for more details
// https://issues.apache.org/jira/browse/SOLR-1967
// http://wiki.apache.org/solr/QueryResponseWriter
// http://wiki.apache.org/solr/SolPHP
$client->setResponseWriter("phpnative");

//$response = $client->ping();

$query = new SolrQuery();

$query->setQuery("*:*");

$query->set("objectClassName""SolrClass");

$query->set("objectPropertiesStorageMode"1); // 0 for independent properties, 1 for combined

try
{

$response $client->query($query);

$resp $response->getResponse();

print_r($response);

print_r($resp);

} catch (
Exception $e) {

print_r($e);

}

?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:



Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)