Class RenameTagger

  • All Implemented Interfaces:
    IXMLConfigurable, IImporterHandler, IDocumentTagger

    public class RenameTagger
    extends AbstractDocumentTagger

    Rename metadata fields to different names.

    Storing values in an existing field

    If a target field with the same name already exists for a document, values will be added to the end of the existing value list. It is possible to change this default behavior by supplying a PropertySetter.

    When using regular expressions, "toField" can also hold replacement patterns (e.g. $1, $2, etc).

    Can be used both as a pre-parse or post-parse handler.

    XML configuration usage:

    
    <handler
        class="com.norconex.importer.handler.tagger.impl.RenameTagger">
      <!-- multiple "restrictTo" tags allowed (only one needs to match) -->
      <restrictTo>
        <fieldMatcher>(field-matching expression)</fieldMatcher>
        <valueMatcher>(value-matching expression)</valueMatcher>
      </restrictTo>
      <!-- multiple rename tags allowed -->
      <rename
          toField="(to field)">
        <fieldMatcher>(one or more matching fields to rename)</fieldMatcher>
      </rename>
    </handler>

    XML usage example:

    
    <handler
        class="RenameTagger">
      <rename
          toField="title"
          onSet="replace">
        <fieldMatcher>dc.title</fieldMatcher>
      </rename>
    </handler>

    The above example renames a "dc.title" field to "title", overwriting any existing values in "title".

    Author:
    Pascal Essiembre