|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.norconex.importer.tagger.impl.ForceSingleValueTagger
public class ForceSingleValueTagger
Forces a metadata field to be single-value. The action can be one of the following:
Can be used both as a pre-parse or post-parse handler.
keepFirst Keeps the first occurrence found. keepLast Keeps the first occurrence found. mergeWith:<sep> Merges all occurrences, joining them with the specified separator (<sep>).
If you do not specify any action, the default behavior is to merge all occurrences, joining values with a comma.
XML configuration usage:
<tagger class="com.norconex.importer.tagger.impl.SingleValueTagger"> <singleValue field="FIELD_NAME" action="[keepFirst|keepLast|mergeWith:<separator>]"/> <-- multiple single value fields allowed --> </tagger>
Constructor Summary | |
---|---|
ForceSingleValueTagger()
|
Method Summary | |
---|---|
void |
addSingleValueField(String field,
String action)
|
boolean |
equals(Object obj)
|
Map<String,String> |
getSingleValueFields()
|
int |
hashCode()
|
void |
loadFromXML(Reader in)
|
void |
removeSingleValueField(String name)
|
void |
saveToXML(Writer out)
|
void |
tagDocument(String reference,
InputStream document,
Properties metadata,
boolean parsed)
Tags a document with extra metadata information. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ForceSingleValueTagger()
Method Detail |
---|
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 Map<String,String> getSingleValueFields()
public void addSingleValueField(String field, String action)
public void removeSingleValueField(String name)
public void loadFromXML(Reader in) throws IOException
loadFromXML
in interface IXMLConfigurable
IOException
public void saveToXML(Writer out) throws IOException
saveToXML
in interface IXMLConfigurable
IOException
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |