Package org.apache.nutch.hostdb
Class UpdateHostDbMapper
java.lang.Object
org.apache.hadoop.mapreduce.Mapper<Text,Writable,Text,NutchWritable>
org.apache.nutch.hostdb.UpdateHostDbMapper
Mapper ingesting HostDB and CrawlDB entries. Additionally it can also read
host score info from a plain text key/value file generated by the
Webgraph's NodeDumper tool.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.mapreduce.Mapper
Mapper.Context -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]protected Stringprotected CrawlDatumprotected ErrorTrackerprotected booleanprotected Counterprotected URLFiltersprotected Textprotected HostDatumprotected booleanprotected URLNormalizersprotected booleanprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringfilterNormalize(String hostName) Filters and or normalizes the input hostname by applying the configured URL filters and normalizers the URL "http://hostname/".voidMapper ingesting records from the HostDB, CrawlDB and plaintext host scores file.void
-
Field Details
-
host
-
hostDatum
-
crawlDatum
-
reprUrl
-
buffer
-
args
-
filter
protected boolean filter -
normalize
protected boolean normalize -
readingCrawlDb
protected boolean readingCrawlDb -
filters
-
normalizers
-
filteredRecordsCounter
-
errorTracker
-
-
Constructor Details
-
UpdateHostDbMapper
public UpdateHostDbMapper()
-
-
Method Details
-
setup
-
filterNormalize
Filters and or normalizes the input hostname by applying the configured URL filters and normalizers the URL "http://hostname/".- Parameters:
hostName- the input hostname- Returns:
- the normalized hostname, or null if the URL is excluded by URL filters or failed to be normalized converted
-
map
public void map(Text key, Writable value, Mapper<Text, Writable, throws IOException, InterruptedExceptionText, NutchWritable>.Context context) Mapper ingesting records from the HostDB, CrawlDB and plaintext host scores file. Statistics and scores are passed on.- Overrides:
mapin classMapper<Text,Writable, Text, NutchWritable> - Parameters:
key- recordTextkeyvalue- associatedWritableobjectcontext-Reducer.Contextfor writing custom counters and output.- Throws:
IOExceptionInterruptedException
-