Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUTCH-3043 Generator: count URLs rejected by URL filters #814

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/java/org/apache/nutch/crawl/Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,12 @@ public void map(Text key, CrawlDatum value, Context context)
// If filtering is on don't generate URLs that don't pass
// URLFilters
try {
if (filters.filter(url.toString()) == null)
if (filters.filter(url.toString()) == null) {
context.getCounter("Generator", "URL_FILTERS_REJECTED").increment(1);
return;
}
} catch (URLFilterException e) {
context.getCounter("Generator", "URL_FILTER_EXCEPTION").increment(1);
LOG.warn("Couldn't filter url: {} ({})", url, e.getMessage());
}
}
Expand All @@ -253,10 +256,7 @@ public void map(Text key, CrawlDatum value, Context context)
try {
sort = scfilters.generatorSortValue(key, crawlDatum, sort);
} catch (ScoringFilterException sfe) {
if (LOG.isWarnEnabled()) {
LOG.warn(
"Couldn't filter generatorSortValue for " + key + ": " + sfe);
}
LOG.warn("Couldn't filter generatorSortValue for {}: {}", key, sfe);
}

// check expr
Expand Down Expand Up @@ -625,7 +625,7 @@ private static int hash(byte[] bytes, int start, int length) {
// make later bytes more significant in hash code, so that sorting
// by hashcode correlates less with by-host ordering.
for (int i = length - 1; i >= 0; i--)
hash = (31 * hash) + (int) bytes[start + i];
hash = (31 * hash) + bytes[start + i];
return hash;
}
}
Expand Down
Loading