Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 20595 программистов и 1112 роботов. Сейчас ищут 410 программистов ...
Приступая к работе

SolrClient::setResponseWriter - Sets the response writer used to prepare the response from Solr

Вернуться к: SolrClient

SolrClient::setResponseWriter

(PECL solr >= 0.9.11)

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

Описание

public void SolrClient::setResponseWriter ( string $responseWriter )

Sets the response writer used to prepare the response from Solr

Список параметров

responseWriter

One of the following:

  • json
  • phps
  • xml

Возвращаемые значения

Эта функция не возвращает значения после выполнения.

Примеры

Пример #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);

$client->setResponseWriter("json");

//$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);

}

?>



Вернуться к: SolrClient

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware