SolrDocument::toArray

(PECL solr >= 0.9.2)

SolrDocument::toArrayReturns an array representation of the document

说明

public SolrDocument::toArray ( void ) : array

Returns an array representation of the document.

参数

此函数没有参数。

返回值

Returns an array representation of the document.

范例

Example #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
                        )

                )

        )

)

相关文章
php deque returns a representation that can be converted to jsonphp maxdb 函数 returns an array of resources representing the fields in a result setphp 函数 returns the bson representation of a json valuephp oci8 函数 returns the next row from a query as a numeric arrayphp ps 函数 takes an gd image and returns an image for placement in a ps documentphp mongodb bson javascript returns a representation that can be converted to jsonphp mongodb bson objectid returns a representation that can be converted to jsonphp mongodb bson regexinterface returns the string representation of this regexinterfacephp mongodb bson serializable provides an array or document to serialize as bsonphp mongodb bson timestampinterface returns the string representation of this timestampinterfacephp mysqli result returns an array of objects representing the fields in a result setphp solrdocument returns an array of child documents solrdocument php solrdocument returns the number of fields in this documentphp solrdocument returns an array of fields names in the documentphp solrdocument returns an array representation of the documentphp solrinputdocument returns an array containing all the fields in the documentphp solrinputdocument returns true if the document has any child documentsphp solrinputdocument returns an array representation of the input documentphp solrquery returns the frequency below which terms will be ignored in the source documentphp solrquery returns the maximum document frequency
关注编程学问公众号