Class ExemptionUrlFilter
java.lang.Object
org.apache.nutch.urlfilter.api.RegexURLFilterBase
org.apache.nutch.urlfilter.regex.RegexURLFilter
org.apache.nutch.urlfilter.ignoreexempt.ExemptionUrlFilter
- All Implemented Interfaces:
Configurable,URLExemptionFilter,URLFilter,Pluggable
This implementation of
URLExemptionFilter
uses regex configuration to check if URL is eligible for exemption from
the db.ignore.external.links configuration property.
When this filter is enabled, the external urls will be checked
against configured sequence of regex rules.
The exemption rule file defaults to
db-ignore-external-exemptions.txt in the classpath but
can be overridden using the configuration property
db.ignore.external.exemptions.file.
regex-urlfilter.txt.
Each non-comment, non-blank line contains a regular expression
prefixed by + or -. The first matching pattern in the file
determines whether a URL is exempted or ignored. If no pattern
matches, the URL is ignored.- Since:
- Feb 10, 2016
- Version:
- 1
- See Also:
-
Field Summary
FieldsFields inherited from class org.apache.nutch.urlfilter.regex.RegexURLFilter
URLFILTER_REGEX_FILE, URLFILTER_REGEX_RULESFields inherited from class org.apache.nutch.urlfilter.api.RegexURLFilterBase
hasHostDomainRulesFields inherited from interface org.apache.nutch.net.URLExemptionFilter
X_POINT_IDFields inherited from interface org.apache.nutch.net.URLFilter
X_POINT_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if toUrl is exempted when the ignore external is enabledprotected ReadergetRulesReader(Configuration conf) Gets reader for regex rulesstatic voidMethods inherited from class org.apache.nutch.urlfilter.regex.RegexURLFilter
createRule, createRuleMethods inherited from class org.apache.nutch.urlfilter.api.RegexURLFilterBase
filter, getConf, main, setConfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
-
Field Details
-
DB_IGNORE_EXTERNAL_EXEMPTIONS_FILE
- See Also:
-
-
Constructor Details
-
ExemptionUrlFilter
public ExemptionUrlFilter()
-
-
Method Details
-
getExemptions
-
filter
Description copied from interface:URLExemptionFilterChecks if toUrl is exempted when the ignore external is enabled- Specified by:
filterin interfaceURLExemptionFilter- Parameters:
fromUrl- : the source url which generated the outlinktoUrl- : the destination url which needs to be checked for exemption- Returns:
- true when toUrl is exempted from dbIgnore
-
getRulesReader
Gets reader for regex rules- Overrides:
getRulesReaderin classRegexURLFilter- Parameters:
conf- is the current configuration.- Returns:
- the name of the resource containing the rules to use.
- Throws:
IOException- if there is a fatal error obtaining theReader
-
main
-