array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'solrdocument.toarray.php', 1 => 'SolrDocument::toArray', 2 => 'Returns an array representation of the document', ), 'up' => array ( 0 => 'class.solrdocument.php', 1 => 'SolrDocument', ), 'prev' => array ( 0 => 'solrdocument.sort.php', 1 => 'SolrDocument::sort', ), 'next' => array ( 0 => 'solrdocument.unserialize.php', 1 => 'SolrDocument::unserialize', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/solr/solrdocument/toarray.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

SolrDocument::toArray

(PECL solr >= 0.9.2)

SolrDocument::toArrayReturns an array representation of the document

Опис

public SolrDocument::toArray(): array

Returns an array representation of the document.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Returns an array representation of the document.

Приклади

Приклад #1 SolrDocument::toArray() example

<?php

$doc
= new SolrDocument();

$doc->addField('id', 1123);

$doc->features = "PHP Client Side";
$doc->features = "Fast development cycles";

$doc['cat'] = 'Software';
$doc['cat'] = 'Custom Search';
$doc->cat = 'Information Technology';

print_r($doc->toArray());

?>

Поданий вище приклад виведе щось схоже на:

Array
(
    [document_boost] => 0
    [field_count] => 3
    [fields] => Array
        (
            [0] => SolrDocumentField Object
                (
                    [name] => id
                    [boost] => 0
                    [values] => Array
                        (
                            [0] => 1123
                        )

                )

            [1] => SolrDocumentField Object
                (
                    [name] => features
                    [boost] => 0
                    [values] => Array
                        (
                            [0] => PHP Client Side
                            [1] => Fast development cycles
                        )

                )

            [2] => SolrDocumentField Object
                (
                    [name] => cat
                    [boost] => 0
                    [values] => Array
                        (
                            [0] => Software
                            [1] => Custom Search
                            [2] => Information Technology
                        )

                )

        )

)