简体   繁体   English

Solr数据将多值字段导入单个值字段

[英]Solr data import multi-valued field into a single valued field

I have a multi-valued field 我有一个多值字段

<arr name="colors">
<str>Blue</str>
<str>Red</str>
<str>Orange</str>
<str>Pink</str>
<str>Violet</str>
</arr>

Filled like this: 像这样填充:

<entity name="pub_attributes" query=" SELECT name [description] FROM dbo.Colors">
       <field name="colors" column="description" />
</entity>

And I need another field with all the colors but only in one line separated by white spaces like 我需要另一个具有所有颜色的字段,但只需要一行用白色空格隔开

<str name="Colors_All">Bue Red Orange Pink Violet</str>

How can I do this without accessing the Colors table all over again?? 我该怎么做而又不用重新访问颜色表? Maybe something like this 也许像这样

<entity name="Properites_all" query="
    DECLARE @all VARCHAR(MAX)
    SET @all = ''    
    Select @all = @all + ... from '${pub_attributes.colors}' 

    UNION
    Another SELECT that will add more info than just the colors
">
    <field name="colors_all" column="description" />
</entity>

我想,您正在寻找的是copyfield: copyfield Wiki ,您也可以在这里看看: 如何使用它希望能对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM