php-doc-en/reference/solr/solrclient/setresponsewriter.xml
Peter Cowburn 8494712d39 tidy up
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@336928 c90b9560-bf6c-de11-be94-00142212c4b1
2015-06-11 22:25:15 +00:00

144 lines
3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="solrclient.setresponsewriter" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SolrClient::setResponseWriter</refname>
<refpurpose>Sets the response writer used to prepare the response from Solr</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>SolrClient::setResponseWriter</methodname>
<methodparam><type>string</type><parameter>responseWriter</parameter></methodparam>
</methodsynopsis>
<para>
Sets the response writer used to prepare the response from Solr
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>responseWriter</parameter></term>
<listitem>
<para>One of the following:</para>
<simplelist>
<member><literal>json</literal></member>
<member><literal>phps</literal></member>
<member><literal>xml</literal></member>
</simplelist>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><methodname>SolrClient::setResponseWriter</methodname> example</title>
<programlisting role="php">
<![CDATA[
<?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);
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->