com.norconex.importer.filter.impl
Class RegexMetadataFilter
java.lang.Object
com.norconex.importer.filter.AbstractOnMatchFilter
com.norconex.importer.filter.impl.RegexMetadataFilter
- All Implemented Interfaces:
- IXMLConfigurable, IDocumentFilter, IOnMatchFilter, IImportHandler, Serializable
public class RegexMetadataFilter
- extends AbstractOnMatchFilter
- implements IDocumentFilter, IXMLConfigurable
Accepts or rejects a document based on its property values using
regular expression.
XML configuration usage:
<filter class="com.norconex.importer.filter.RegexMetadataFilter"
onMatch="[include|exclude]"
caseSensitive="[false|true]" >
property="(name of metadata name to match)"
(regular expression of value to match)
</filter>
- Author:
- Pascal Essiembre
- See Also:
- Serialized Form
RegexMetadataFilter
public RegexMetadataFilter()
RegexMetadataFilter
public RegexMetadataFilter(String header,
String regex)
RegexMetadataFilter
public RegexMetadataFilter(String header,
String regex,
OnMatch onMatch)
RegexMetadataFilter
public RegexMetadataFilter(String header,
String regex,
OnMatch onMatch,
boolean caseSensitive)
getRegex
public String getRegex()
isCaseSensitive
public boolean isCaseSensitive()
getProperty
public String getProperty()
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive)
setProperty
public void setProperty(String property)
setRegex
public void setRegex(String regex)
acceptDocument
public final boolean acceptDocument(InputStream document,
Properties metadata,
boolean parsed)
throws IOException
- Description copied from interface:
IDocumentFilter
- Whether to accepts a document.
- Specified by:
acceptDocument
in interface IDocumentFilter
- Parameters:
document
- the document to evaluatemetadata
- document metadataparsed
- whether the document has been parsed already or not (a
parsed document should normally be text-based)
- Returns:
true
if document is accepted
- Throws:
IOException
- problem reading the document
loadFromXML
public void loadFromXML(Reader in)
- Specified by:
loadFromXML
in interface IXMLConfigurable
saveToXML
public void saveToXML(Writer out)
throws IOException
- Specified by:
saveToXML
in interface IXMLConfigurable
- Throws:
IOException
toString
public String toString()
- Overrides:
toString
in class AbstractOnMatchFilter
hashCode
public int hashCode()
- Overrides:
hashCode
in class AbstractOnMatchFilter
equals
public boolean equals(Object obj)
- Overrides:
equals
in class AbstractOnMatchFilter
Copyright © 2009-2013 Norconex Inc.. All Rights Reserved.