Class ExtractCategoryLevelDataProcessor

  • All Implemented Interfaces:
    DocumentPreProcessor

    public class ExtractCategoryLevelDataProcessor
    extends Object
    implements DocumentPreProcessor
    Extracts the category levels of a single category path field into separate level and a leaf field if the *lvl and *leaf fields exists in the field configuration. Example:
     source:
     category: [A/B/C/D, Z/X/Y]
     becomes:
     category_lvl_0: A,Z
     category_lvl_1: B,X
     category_lvl_2: C,Y
     category_lvl_3: D
     category_leaf: D,Y
     
    Will be auto configured if the following configuration entry is present:
      data-processor-configuration: 
       processors:
         - ExtractCategoryLevelDataProcessor
     
    Author:
    hjk
    See Also:
    CategorySearchData
    • Constructor Detail

      • ExtractCategoryLevelDataProcessor

        public ExtractCategoryLevelDataProcessor()
    • Method Detail

      • 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
        preProcessorConfig - custom string-to-string map that can be configured per DocumentPreProcessor.
      • process

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