首页 > 其他 > 详细

nutch batchid

时间:2014-02-26 11:06:49      阅读:431      评论:0      收藏:0      [点我收藏+]

 问题:

nutch默认在fetch的时候batchid是-all。这样导致只要有batchid的记录都会被从新抓取,从新parse。记录比较多的时候会非常慢,而且没有必要。

代码:

fetchJob

1
2
3
4
5
6
7
8
9
10
11
12
13
public Map<String,Object> run(Map<String,Object> args) throws Exception {
   checkConfiguration();
   String batchId = (String)args.get(Nutch.ARG_BATCH);
   Integer threads = (Integer)args.get(Nutch.ARG_THREADS);
   Boolean shouldResume = (Boolean)args.get(Nutch.ARG_RESUME);
   Integer numTasks = (Integer)args.get(Nutch.ARG_NUMTASKS);
 
   if (threads != null && threads > 0) {
     getConf().setInt(THREADS_KEY, threads);
   }
   if (batchId == null) {
       batchId = Nutch.ALL_BATCH_ID_STR;
   }

  这样batchid就是-all。我改成了batchId = getConf().get(GeneratorJob.BATCH_ID);只抓GeneratorJob标记的url

nutch batchid

原文:http://www.cnblogs.com/fengjiaoan/p/3567509.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!