Hi, I have been reading the solr book and wiki, but I cant find any similar examples to what Im looking for.

I have a database field called category, this field needs some text manipulation before it goes in the index

here is the java code for what im trying to do:

// categories look like this "prefix category suffix"
// I want to turn them into "category" remove prefix and suffix and spaces before and after
 public static String getPrettyCategoryName(String categoryName)
    {
        String result;

        if (categoryName == null || categoryName.equals(""))
        {
            // nothing to do; just return what was passed in.
            result = categoryName;
        }
        else
        {
            result = categoryName.toLowerCase();

            if (result.startsWith(startString))
            {
                result = result.substring(startString.length());
            }

            if (result.endsWith(endString))
            {
result = result.substring(0, (result.length() - endString
                    .length()));
            }

            if (result.length() > 0)
            {
                result = Character.toUpperCase(result.charAt(0))
                    + result.substring(1);
            }
        }

        return result;
    }


Can I have a transformer call a java method?

It seems like I can, but how do I transform must one column. If someone can point me to a complete example that transforms a column using java or javascript im sure I can figure this out


thanks
Joel

Reply via email to