SolrDocument::toArray

(PECL solr >= 0.9.2)

SolrDocument::toArray返回文档的数组表示

描述

public SolrDocument::toArray(): array

返回文档的数组表示。

参数

此函数没有参数。

返回值

返回文档的数组表示。

示例

示例 #1 SolrDocument::toArray() 示例

<?php

$doc
= new SolrDocument();

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

$doc->features = "PHP 客户端";
$doc->features = "快速开发周期";

$doc['cat'] = '软件';
$doc['cat'] = '自定义搜索';
$doc->cat = '信息技术';

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
                        )

                )

        )

)

添加注释

用户贡献的注释

此页面没有用户贡献的注释。
To Top