1

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>
Nicole
  • 1,356
  • 3
  • 21
  • 41

1 Answers1

0

I think, what you looking for is copyfield: copyfield wiki and also you can take a look here:how to use it Hope that will help.

Community
  • 1
  • 1
vuky
  • 583
  • 6
  • 19
  • I tried that but copying from a multi-valued to a single-valued is not working, plus, I need to add extra info to the field "Colors_All", thats why I need to reference the "colors" attribute in the query so after that I can add more words to it. Thanks anyway! – Nicole Jul 25 '12 at 15:15
  • 2
    In that case, if you use DIH (Data importer handler) for import, you can use scriptTransformer at import/index time: [link](http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer) – vuky Jul 26 '12 at 05:46