Package de.cxp.ocs.preprocessor.impl
Class FlagFieldDataProcessor
java.lang.Object
de.cxp.ocs.preprocessor.impl.FlagFieldDataProcessor
- All Implemented Interfaces:
DocumentPreProcessor
ConfigureableDataprocessor implementation 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 with FlagFieldConfiguration.GROUP_PREFIX
# the label after the prefix can be anything, import is though that they end with
# FlagFieldConfiguration.GROUP_SEPARATOR and 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
# appending FlagFieldConfiguration.FIELD_MATCH after 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 by FlagFieldConfiguration.SEPARATOR
group_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_DESTINATION to 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidinitialize(FieldConfigAccess fieldConfig, Map<String, String> confMap) DataPreProcessor MUST have a no-args constructor.booleanCalled for each source document.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.cxp.ocs.spi.indexer.DocumentPreProcessor
finish
-
Constructor Details
-
FlagFieldDataProcessor
public FlagFieldDataProcessor()
-
-
Method Details
-
initialize
Description copied from interface:DocumentPreProcessorDataPreProcessor MUST have a no-args constructor. To configure it afterwards, this method will be used.- Specified by:
initializein interfaceDocumentPreProcessor- Parameters:
fieldConfig- field config accessconfMap- custom string-to-string map that can be configured per DocumentPreProcessor.
-
process
Description copied from interface:DocumentPreProcessorCalled for each source document.- Specified by:
processin interfaceDocumentPreProcessor- Parameters:
document- source documentvisible- weather or not the record is currently marked for indexing.- Returns:
trueif the record should be indexed,falseotherwise.
-