簡體   English   中英

Solr數據將多值字段導入單個值字段

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

我有一個多值字段

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

像這樣填充:

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

我需要另一個具有所有顏色的字段,但只需要一行用白色空格隔開

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

我該怎么做而又不用重新訪問顏色表? 也許像這樣

<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