mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
M reference/solr/solrclient/construct.xml
A reference/solr/solrclient/setresponsewriter.xml M reference/solr/versions.xml Added support for new native response writer for php clients https://issues.apache.org/jira/browse/SOLR-1967 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@300649 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
48e96a6563
commit
3326d8da30
3 changed files with 160 additions and 0 deletions
|
@ -37,6 +37,7 @@
|
|||
- hostname (The hostname for the Solr server)
|
||||
- port (The port number)
|
||||
- path (The path to solr)
|
||||
- wt (The name of the response writer e.g. xml, phpnative)
|
||||
- login (The username used for HTTP Authentication, if any)
|
||||
- password (The HTTP Authentication password)
|
||||
- proxy_host (The hostname for the proxy server, if any)
|
||||
|
@ -78,6 +79,8 @@ $options = array
|
|||
'login' => SOLR_SERVER_USERNAME,
|
||||
'password' => SOLR_SERVER_PASSWORD,
|
||||
'port' => SOLR_SERVER_PORT,
|
||||
'path' => SOLR_PATH_TO_SOLR,
|
||||
'wt' => SOLR_PHP_NATIVE_RESPONSE_WRITER,
|
||||
);
|
||||
|
||||
$client = new SolrClient($options);
|
||||
|
|
156
reference/solr/solrclient/setresponsewriter.xml
Normal file
156
reference/solr/solrclient/setresponsewriter.xml
Normal file
|
@ -0,0 +1,156 @@
|
|||
<?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>
|
||||
<para>
|
||||
<![CDATA[
|
||||
- xml
|
||||
- phpnative
|
||||
]]>
|
||||
</para>
|
||||
</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);
|
||||
|
||||
// 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);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
|
||||
]]>
|
||||
</screen>
|
||||
</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
|
||||
-->
|
|
@ -73,6 +73,7 @@
|
|||
<function name='solrclient::__wakeup' from='PECL solr >= 0.9.2'/>
|
||||
<function name='solrclient::__clone' from='PECL solr >= 0.9.2'/>
|
||||
<function name='solrclient::setservlet' from='PECL solr >= 0.9.2'/>
|
||||
<function name='solrclient::setresponsewriter' from='PECL solr >= 0.9.11'/>
|
||||
<function name='solrclient::getoptions' from='PECL solr >= 0.9.6'/>
|
||||
<function name='solrclient::getdebug' from='PECL solr >= 0.9.7'/>
|
||||
<function name='solrclient::query' from='PECL solr >= 0.9.2'/>
|
||||
|
|
Loading…
Reference in a new issue