I believe I've got a one line fix that will avoid adding fields to documents when there is no value.

In  org.solrmarc.tools.Utils.java

in the first remap() method (first argument is a String):

add this before the return statement at the end:

        if (result.length() == 0) return null;

So the method is:


    public static String remap(String fieldVal, Map<String, String> map, boolean copyEntryIfNotInMap)
    {
     StringBuffer result = new StringBuffer("");

        

        if (map.containsKey(fieldVal))
        {
         result.append(map.get(fieldVal));
        }

        

        else if (copyEntryIfNotInMap)
        {
         result.append(fieldVal);
        }
        if (result.length() == 0) return null;
        return result.toString();
    }

Enjoy!

Naomi Dushay
ndushay@stanford.edu