public class NoContentTransformer extends AbstractDocumentTransformer implements IXMLConfigurable
Get rid of the content stream and optionally store it as text into a metadata field instead.
If a toField
with the same name already exists for a document,
the value will be added to the end of the existing value list.
It is possible to change this default behavior by supplying a
PropertySetter
.
This class can be used both as a pre-parsing or post-parsing handler. To store the content in a field, make sure pre-parsing is of a text content-types.
<handler
class="com.norconex.importer.handler.transformer.impl.NoContentTransformer"
toField="(Optionally store content into a field.)"
onSet="[append|prepend|replace|optional]">
<!-- 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>
</handler>
<handler
class="NoContentTransformer"/>
The above example removes the content of all documents (leaving you with metadata only).
Constructor and Description |
---|
NoContentTransformer() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
PropertySetter |
getOnSet() |
String |
getToField() |
int |
hashCode() |
protected void |
loadHandlerFromXML(XML xml)
Loads configuration settings specific to the implementing class.
|
protected void |
saveHandlerToXML(XML xml)
Saves configuration settings specific to the implementing class.
|
void |
setOnSet(PropertySetter onSet) |
void |
setToField(String toField) |
String |
toString() |
protected void |
transformApplicableDocument(HandlerDoc doc,
InputStream input,
OutputStream output,
ParseState parseState) |
transformDocument
addRestriction, addRestriction, addRestrictions, clearRestrictions, detectCharsetIfBlank, getRestrictions, isApplicable, loadFromXML, removeRestriction, removeRestriction, saveToXML
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
loadFromXML, saveToXML
public String getToField()
public void setToField(String toField)
public PropertySetter getOnSet()
public void setOnSet(PropertySetter onSet)
protected void transformApplicableDocument(HandlerDoc doc, InputStream input, OutputStream output, ParseState parseState) throws ImporterHandlerException
transformApplicableDocument
in class AbstractDocumentTransformer
ImporterHandlerException
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.