2


我正在尝试在我的弹性搜索服务器中设置城市索引,
每个城市都有一个标签数组,我想将这些标签索引为数组我所做的:config.yml:

                        tags: {type:"string", boost: 3} 

我的文件:

/**
 * @MongoDB\Collection
 */
protected $tokens=array();

标签格式:

"tags": ["Bindura", "Bindura Town", "Kimberley Reefs", "\u0411\u0438\u043d\u0434\u0443\u0440\u0430"],

当我运行: fos:elastica:populate 时,我得到

 Array to string conversion in....ODM/BundleNameDocumentCitiesHydrator.php

在那一行我有:

/** @Field(type="string") */
        if (isset($data['tokens'])) {
            $value = $data['tokens'];
            $return = (string) $token;
            $this->class->reflFields['tokens']->setValue($document, $return);
            $hydratedData['tokens'] = $return;

我怎样才能解决这个问题 ?如何在 elasticaBundle 中索引数组,我查看了文档,似乎我没有做错任何事情..

4

0 回答 0