Class AttributeToDataFieldConverter

java.lang.Object
de.cxp.ocs.preprocessor.impl.AttributeToDataFieldConverter
All Implemented Interfaces:
DocumentPreProcessor

public class AttributeToDataFieldConverter extends Object implements DocumentPreProcessor

Converts attributes to a standard data field. Per default all attributes are taken that do not have an ID.

If the include option is set, the according attribute is also converted even if it has an ID.

As option for the attribute converter, include or exclude can be defined to restrict the attributes that should be converted.

  • include: name1,name2
  • exclude: name3

If include is defined, only the according attributes are converted. So it does not make sense to defined both options

Attention: be aware that attributes also have a special handling regarding dynamic configuration. If an attribute is converted into a document field, the according field-configuration might not apply anymore.

Author:
rb@commerce-experts.com
  • Constructor Details

    • AttributeToDataFieldConverter

      public AttributeToDataFieldConverter()
  • Method Details

    • initialize

      public void initialize(FieldConfigAccess fieldConfig, Map<String,String> preProcessorConfig)
      Description copied from interface: DocumentPreProcessor
      DataPreProcessor MUST have a no-args constructor. To configure it afterwards, this method will be used.
      Specified by:
      initialize in interface DocumentPreProcessor
      Parameters:
      fieldConfig - field config access
      preProcessorConfig - custom string-to-string map that can be configured per DocumentPreProcessor.
    • process

      public boolean process(Document sourceDocument, boolean visible)
      Description copied from interface: DocumentPreProcessor
      Called for each source document.
      Specified by:
      process in interface DocumentPreProcessor
      Parameters:
      sourceDocument - source document
      visible - weather or not the record is currently marked for indexing.
      Returns:
      true if the record should be indexed, false otherwise.