mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-23 22:52:12 +01:00
163 lines
4.1 KiB
XML
163 lines
4.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: d00128a85a6c2e8e5ae4545fdd23368df8cfa079 Maintainer: leonardolara Status: ready -->
|
|
|
|
<refentry xml:id="solrinputdocument.addchilddocuments" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>SolrInputDocument::addChildDocuments</refname>
|
|
<refpurpose>Adiciona um array de documentos filhos</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>void</type><methodname>SolrInputDocument::addChildDocuments</methodname>
|
|
<methodparam><type>array</type><parameter role="reference">docs</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Adiciona um array de documentos filhos ao documento de entrada atual.
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>docs</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Um <type>array</type> de objetos <type>SolrInputDocument</type>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.void;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Lança uma <classname>SolrIllegalArgumentException</classname> em caso de falha.
|
|
</para>
|
|
<para>
|
|
Lança uma <classname>SolrException</classname> em caso de falha interna.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title>Exemplo de <function>SolrInputDocument::addChildDocuments</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
include "bootstrap.php";
|
|
|
|
$options = array
|
|
(
|
|
'hostname' => SOLR_SERVER_HOSTNAME,
|
|
'login' => SOLR_SERVER_USERNAME,
|
|
'password' => SOLR_SERVER_PASSWORD,
|
|
'port' => SOLR_SERVER_PORT,
|
|
'path' => SOLR_SERVER_STORE_PATH,
|
|
);
|
|
|
|
$client = new SolrClient($options);
|
|
|
|
$product = new SolrInputDocument();
|
|
|
|
$product->addField('id', 'P-BLACK');
|
|
$product->addField('cat', 'tshirt');
|
|
$product->addField('cat', 'polo');
|
|
$product->addField('content_type', 'product');
|
|
|
|
$small = new SolrInputDocument();
|
|
$small->addField('id', 'TS-BLK-S');
|
|
$small->addField('content_type', 'sku');
|
|
$small->addField('size', 'S');
|
|
$small->addField('inventory', 100);
|
|
|
|
$medium = new SolrInputDocument();
|
|
$medium->addField('id', 'TS-BLK-M');
|
|
$medium->addField('content_type', 'sku');
|
|
$medium->addField('size', 'M');
|
|
$medium->addField('inventory', 200);
|
|
|
|
$large = new SolrInputDocument();
|
|
$large->addField('id', 'TS-BLK-L');
|
|
$large->addField('content_type', 'sku');
|
|
$large->addField('size', 'L');
|
|
$large->addField('inventory', 300);
|
|
|
|
// adiciona documentos filho
|
|
$skus = [$small, $medium, $large];
|
|
$product->addChildDocuments($skus);
|
|
|
|
// adiciona o bloco de documento do produto ao índice
|
|
$updateResponse = $client->addDocument(
|
|
$product,
|
|
true, // substitui se o documento existir
|
|
10000 // confirma em 10 segundos
|
|
);
|
|
|
|
print_r($updateResponse->getResponse());
|
|
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
SolrObject Object
|
|
(
|
|
[responseHeader] => SolrObject Object
|
|
(
|
|
[status] => 0
|
|
[QTime] => 5
|
|
)
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</refsect1>
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><methodname>SolrInputDocument::addChildDocument</methodname></member>
|
|
<member><methodname>SolrInputDocument::hasChildDocuments</methodname></member>
|
|
<member><methodname>SolrInputDocument::getChildDocuments</methodname></member>
|
|
<member><methodname>SolrInputDocument::getChildDocumentsCount</methodname></member>
|
|
</simplelist>
|
|
</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
|
|
-->
|