Class ConstantTagger

  • All Implemented Interfaces:
    IXMLConfigurable, IImporterHandler, IDocumentTagger

    public class ConstantTagger
    extends AbstractDocumentTagger

    Define and add constant values to documents. To add multiple constant values under the same constant name, repeat the constant entry with a different value.

    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 with setOnSet(PropertySetter).

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

    XML configuration usage:

    
    <handler
        class="com.norconex.importer.handler.tagger.impl.ConstantTagger">
      <!-- multiple "restrictTo" tags allowed (only one needs to match) -->
      <restrictTo>
        <fieldMatcher>(field-matching expression)</fieldMatcher>
        <valueMatcher>(value-matching expression)</valueMatcher>
      </restrictTo>
      <!-- multiple constant tags allowed -->
      <constant
          name="CONSTANT_NAME">
        Constant Value
      </constant>
    </handler>

    XML usage example:

    
    <handler
        class="ConstantTagger">
      <constant
          name="source">
        web
      </constant>
    </handler>

    The above example adds a constant to incoming documents to identify they were web documents.

    Author:
    Pascal Essiembre