Class CopyTagger

  • All Implemented Interfaces:
    IXMLConfigurable, IImporterHandler, IDocumentTagger

    public class CopyTagger
    extends AbstractDocumentTagger

    Copies metadata fields.

    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.

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

    XML configuration usage:

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

    XML usage example:

    
    <handler
        class="CopyTagger">
      <copy
          toField="author"
          onSet="append">
        <fieldMatcher
            method="regex">
          (creator|publisher)
        </fieldMatcher>
      </copy>
    </handler>

    Copies the value of a "creator" and "publisher" fields into an "author" field, adding to any existing values in the "author" field.

    Since:
    1.3.0
    Author:
    Pascal Essiembre