views:

263

answers:

0

I am running Solr 1.4 with the Jetty web server. I have a transformer, written in JavaScript in my data-config.xml file, that looks as follows:

    <script><![CDATA[
        function transform(row) {

            var itemColor = row.get('ItemColor');

            if (itemColor == 'SORT' || itemColor == 'BLACK') {
                row.put('ItemColor', 'Sort');
            }

            else if (itemColor == 'RØD' || itemColor == 'RED') {
                row.put('ItemColor', 'Rød');
        }

        return row;
    }
    ]]></script>

Basically, what I am trying to do is to replace 'RØD' and 'RED' with 'Rød', and 'SORT' and 'BLACK' with 'Sort' before I add itemColor to the Solr index. ('SORT' is black and 'RØD' is red in Danish).

But for some reason the else-if part is never true, although itemColor has the value 'RØD'. There are no problems updating itemColor when the value is 'SORT' or 'BLACK'. I suspect it has something to do with special characters (Æ, Ø, and Å). I have tried with colors that contains those characters and it fails every time.

What is the solution?