ข้อมูล Solr นำเข้าฟิลด์ที่มีหลายค่าลงในฟิลด์ที่มีค่าเดียว

ฉันมีฟิลด์หลายค่า

<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>

person Nicole    schedule 23.07.2012    source แหล่งที่มา
comment
คุณช่วยยอมรับคำตอบเพิ่มเติมที่คุณได้รับก่อนหน้านี้ได้ไหม   -  person javanna    schedule 24.07.2012


คำตอบ (1)


ฉันคิดว่าสิ่งที่คุณกำลังมองหาคือ copyfield: copyfield wiki และคุณยังสามารถใช้ ดูที่นี่:วิธีใช้งาน หวังว่าจะช่วยได้

person vuky    schedule 25.07.2012
comment
ฉันพยายามแล้ว แต่การคัดลอกจากหลายค่าไปเป็นค่าเดียวนั้นใช้งานไม่ได้ นอกจากนี้ ฉันต้องเพิ่มข้อมูลเพิ่มเติมลงในฟิลด์ Colours_All นั่นคือสาเหตุที่ฉันต้องอ้างอิงแอตทริบิวต์ของสีในแบบสอบถาม ดังนั้นหลังจากนั้นฉันก็สามารถเพิ่มได้ คำพูดเพิ่มเติมเกี่ยวกับมัน ขอบคุณนะ! - person Nicole; 25.07.2012
comment
ในกรณีนั้น หากคุณใช้ DIH (ตัวจัดการตัวนำเข้าข้อมูล) สำหรับการนำเข้า คุณสามารถใช้ scriptTransformer ในเวลานำเข้า/ดัชนี: ลิงก์ - person vuky; 26.07.2012