Package de.cxp.ocs.preprocessor.impl
Class FlagFieldDataProcessor
- java.lang.Object
-
- de.cxp.ocs.preprocessor.impl.FlagFieldDataProcessor
-
- All Implemented Interfaces:
DocumentPreProcessor
public class FlagFieldDataProcessor extends Object implements DocumentPreProcessor
ConfigureableDataprocessorimplementation which fills a flag field based on a pattern match in a source field. Will be auto configured and can be further configuration like described below:data-processor-configuration: processors: - FlagFieldDataProcessor configuration: FlagFieldDataProcessor: # Multiple fields can be evaluated to flag one destination field. # Thus you must prefix your configuration withFlagFieldConfiguration.GROUP_PREFIX# the label after the prefix can be anything, import is though that they end with #FlagFieldConfiguration.GROUP_SEPARATORand that they have the same value for a group, # like the numeric values 1 and 2 below. For each field a match value can be provided by # appendingFlagFieldConfiguration.FIELD_MATCHafter the field name. Rules get evaluated # in order and as soon as one rule matches, the matching value is written into the flag field # and no further rules gets evaluated. group_1_title: \bfür\b\s+.+ group_1_title_match: 0.9 # Multiple regular expression can be provided separated byFlagFieldConfiguration.SEPARATORgroup_1_category: \bzubeh(ö|oe)r\b##.*zubeh(ö|oe)r\b # If multiple regular expression are defined, multiple match values need to # be provided as well. Every expression needs exactly one value. group_1_category_match: 1##0.8 group_1_price: ^[\\d{,2}](\\.\\d) group_1_price_match: 0.3 # One must provide a destination flag field per group by appending #FlagFieldConfiguration.FIELD_FLAG_DESTINATIONto the field name. group_1_destination: "isAccessoire" # Optionally a no match value can by supplied which will be written into the destination # field if no rule within a group matched. group_1_noMatch: -1 # Multiple groups are all evaluated, regardless if a previous group had a match or not. group_2_kpi: ".+" group_2_destination: "kpi" group_2_noMatch: 0
-
-
Constructor Summary
Constructors Constructor Description FlagFieldDataProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize(FieldConfigAccess fieldConfig, Map<String,String> confMap)DataPreProcessor MUST have a no-args constructor.booleanprocess(Document document, boolean visible)Called for each source document.
-
-
-
Method Detail
-
initialize
public void initialize(FieldConfigAccess fieldConfig, Map<String,String> confMap)
Description copied from interface:DocumentPreProcessorDataPreProcessor MUST have a no-args constructor. To configure it afterwards, this method will be used.- Specified by:
initializein interfaceDocumentPreProcessorconfMap- custom string-to-string map that can be configured per DocumentPreProcessor.
-
process
public boolean process(Document document, boolean visible)
Description copied from interface:DocumentPreProcessorCalled for each source document.- Specified by:
processin interfaceDocumentPreProcessorvisible- weather or not the record is currently marked for indexing.- Returns:
trueif the record should be indexed,falseotherwise.
-
-