Search code examples
solrdataimporthandler

How to do multiple replacements with Solr DIH RegexTransformer?


I am using Solr DataImportHandler with RegexTransformer and for a certain field I'd like to replace different patterns with different values. Say, replace Smith with Miller and John with Joe. A single replacement is easy:

<field column="text" regex="Smith" replaceWith="Miller"/>

But how to do the second part, replace John with Joe?

Note this is not asking for a fancy regex but rather how to apply more than one substitution on a single field.


Solution

  • Found a solution. Quite simple really:

    <field column="text" regex="Smith" replaceWith="Miller"/>
    <field column="text" regex="John" replaceWith="Joe"/>