MCPcopy Create free account
hub / github.com/apache/nutch / map

Method map

src/java/org/apache/nutch/parse/ParserJob.java:118–160  ·  view source on GitHub ↗
(String key, WebPage page, Context context)

Source from the content-addressed store, hash-verified

116 }
117
118 @Override
119 public void map(String key, WebPage page, Context context)
120 throws IOException, InterruptedException {
121 String unreverseKey = TableUtil.unreverseUrl(key);
122 if (batchId.equals(REPARSE)) {
123 LOG.debug("Reparsing " + unreverseKey);
124 } else {
125 if (Mark.FETCH_MARK.checkMark(page) == null) {
126 if (LOG.isDebugEnabled()) {
127 LOG.debug("Skipping {}, not fetched yet", unreverseKey);
128 }
129 return;
130 }
131 if (shouldResume && Mark.PARSE_MARK.checkMark(page) != null) {
132 if (force) {
133 LOG.info("Forced parsing " + unreverseKey + "; already parsed");
134 } else {
135 LOG.info("Skipping " + unreverseKey + "; already parsed");
136 return;
137 }
138 } else {
139 LOG.info("Parsing " + unreverseKey);
140 }
141 }
142
143 if (skipTruncated && isTruncated(unreverseKey, page)) {
144 return;
145 }
146
147 if (sitemap && URLFilters.isSitemap(page)) {
148 LOG.info("Parsing for sitemap"); //TODO this log should be top line
149 parseUtil.processSitemapParse(unreverseKey, page, context);
150 } else {
151 parseUtil.process(unreverseKey, page);
152 }
153 ParseStatus pstatus = page.getParseStatus();
154 if (pstatus != null) {
155 context.getCounter("ParserStatus",
156 ParseStatusCodes.majorCodes[pstatus.getMajorCode()]).increment(1);
157 }
158
159 context.write(key, page);
160 }
161 }
162
163 public ParserJob() {

Callers

nothing calls this directly

Calls 10

unreverseUrlMethod · 0.95
isSitemapMethod · 0.95
getMajorCodeMethod · 0.95
checkMarkMethod · 0.80
isTruncatedMethod · 0.80
processSitemapParseMethod · 0.80
processMethod · 0.80
writeMethod · 0.65
equalsMethod · 0.45
getParseStatusMethod · 0.45

Tested by

no test coverage detected