public class DeleteTagger extends AbstractDocumentTagger
Delete the metadata fields provided. Exact field names (case-insensitive) to delete can be provided as well as a regular expression that matches one or many fields.
Can be used both as a pre-parse or post-parse handler.
<handler
class="com.norconex.importer.handler.tagger.impl.DeleteTagger">
<!-- multiple "restrictTo" tags allowed (only one needs to match) -->
<restrictTo>
<fieldMatcher
method="[basic|csv|wildcard|regex]"
ignoreCase="[false|true]"
ignoreDiacritic="[false|true]"
partial="[false|true]">
(field-matching expression)
</fieldMatcher>
<valueMatcher
method="[basic|csv|wildcard|regex]"
ignoreCase="[false|true]"
ignoreDiacritic="[false|true]"
partial="[false|true]">
(value-matching expression)
</valueMatcher>
</restrictTo>
<fieldMatcher
method="[basic|csv|wildcard|regex]"
ignoreCase="[false|true]"
ignoreDiacritic="[false|true]"
partial="[false|true]">
(one or more matching fields to delete)
</fieldMatcher>
</handler>
<handler
class="DeleteTagger">
<fieldMatcher
method="regex">
^[Xx]-.*
</fieldMatcher>
</handler>
The above deletes all metadata fields starting with "X-".
Constructor and Description |
---|
DeleteTagger() |
Modifier and Type | Method and Description |
---|---|
void |
addField(String field)
Deprecated.
Since 3.0.0, use
setFieldMatcher(TextMatcher) |
boolean |
equals(Object other) |
TextMatcher |
getFieldMatcher()
Gets field matcher for fields to delete.
|
List<String> |
getFields()
Deprecated.
Since 3.0.0, use
getFieldMatcher() |
String |
getFieldsRegex()
Deprecated.
Since 3.0.0, use
getFieldMatcher() |
int |
hashCode() |
protected void |
loadHandlerFromXML(XML xml)
Loads configuration settings specific to the implementing class.
|
void |
removeField(String field)
Deprecated.
Since 3.0.0, use
setFieldMatcher(TextMatcher) |
protected void |
saveHandlerToXML(XML xml)
Saves configuration settings specific to the implementing class.
|
void |
setFieldMatcher(TextMatcher fieldMatcher)
Sets the field matcher for fields to delete.
|
void |
setFields(List<String> fieldsToRemove)
Deprecated.
Since 3.0.0, use
setFieldMatcher(TextMatcher) |
void |
setFieldsRegex(String fieldsRegex)
Deprecated.
Since 3.0.0, use
setFieldMatcher(TextMatcher) |
void |
tagApplicableDocument(HandlerDoc doc,
InputStream document,
ParseState parseState) |
String |
toString() |
tagDocument
addRestriction, addRestriction, addRestrictions, clearRestrictions, detectCharsetIfBlank, getRestrictions, isApplicable, loadFromXML, removeRestriction, removeRestriction, saveToXML
public void tagApplicableDocument(HandlerDoc doc, InputStream document, ParseState parseState) throws ImporterHandlerException
tagApplicableDocument
in class AbstractDocumentTagger
ImporterHandlerException
public TextMatcher getFieldMatcher()
public void setFieldMatcher(TextMatcher fieldMatcher)
fieldMatcher
- field matcher@Deprecated public List<String> getFields()
getFieldMatcher()
@Deprecated public void addField(String field)
setFieldMatcher(TextMatcher)
field
- fields to add@Deprecated public void removeField(String field)
setFieldMatcher(TextMatcher)
field
- field to remove@Deprecated public void setFields(List<String> fieldsToRemove)
setFieldMatcher(TextMatcher)
fieldsToRemove
- fields to delete@Deprecated public String getFieldsRegex()
getFieldMatcher()
@Deprecated public void setFieldsRegex(String fieldsRegex)
setFieldMatcher(TextMatcher)
fieldsRegex
- field matcher pattern.protected void loadHandlerFromXML(XML xml)
AbstractImporterHandler
loadHandlerFromXML
in class AbstractImporterHandler
xml
- XML configurationprotected void saveHandlerToXML(XML xml)
AbstractImporterHandler
saveHandlerToXML
in class AbstractImporterHandler
xml
- the XMLpublic boolean equals(Object other)
equals
in class AbstractImporterHandler
public int hashCode()
hashCode
in class AbstractImporterHandler
public String toString()
toString
in class AbstractImporterHandler
Copyright © 2009–2023 Norconex Inc.. All rights reserved.