public class HierarchyTagger extends Object implements IDocumentTagger, IXMLConfigurable
/vegetable/potato/sweetWe specify a slash (/) separator and it will produce the folowing entries in the specified document metadata field:
/vegetable /vegetable/potato /vegetable/potato/sweetCan be used both as a pre-parse or post-parse handler. XML configuration usage:
<tagger class="com.norconex.importer.tagger.impl.HierarchyTagger"> <hierarchy fromField="(from field)" toField="(to field)" fromSeparator="(original separator)" toSeparator="(new separator)" overwrite="[false|true]" /> <-- multiple hierarchy tags allowed --> </tagger>
Constructor and Description |
---|
HierarchyTagger() |
Modifier and Type | Method and Description |
---|---|
void |
addHierarcyDetails(String fromField,
String toField,
String fromSeparator,
String toSeparator,
boolean overwrite)
Adds hierarchy instructions.
|
boolean |
equals(Object obj) |
int |
hashCode() |
void |
loadFromXML(Reader in) |
void |
saveToXML(Writer out) |
void |
tagDocument(String reference,
InputStream document,
Properties metadata,
boolean parsed)
Tags a document with extra metadata information.
|
String |
toString() |
public void tagDocument(String reference, InputStream document, Properties metadata, boolean parsed) throws IOException
IDocumentTagger
tagDocument
in interface IDocumentTagger
reference
- document reference (e.g. URL)document
- documentmetadata
- document metadataparsed
- whether the document has been parsed already or not (a
parsed document should normally be text-based)IOException
- problem reading the documentpublic void addHierarcyDetails(String fromField, String toField, String fromSeparator, String toSeparator, boolean overwrite)
fromField
- source field nametoField
- target optional target field namefromSeparator
- source separatortoSeparator
- optional target separatoroverwrite
- whether to overwrite target field if it existspublic void loadFromXML(Reader in) throws IOException
loadFromXML
in interface IXMLConfigurable
IOException
public void saveToXML(Writer out) throws IOException
saveToXML
in interface IXMLConfigurable
IOException
Copyright © 2009-2014 Norconex Inc.. All Rights Reserved.