简体   繁体   中英

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 ,您也可以在这里看看: 如何使用它希望能对您有所帮助。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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