public void reduce(Text key,Iterator<ObjectWritable> values,OutputCollector<Text,CrawlDatum> output,Reporter reporter) throws IOException {
  String url=key.toString();
  Node node=null;
  CrawlDatum datum=null;
  while (values.hasNext()) {
    ObjectWritable next=values.next();
    Object value=next.get();
    if (value instanceof Node) {
      node=(Node)value;
    }
 else     if (value instanceof CrawlDatum) {
      datum=(CrawlDatum)value;
    }
  }
  if (datum != null) {
    if (node != null) {
      float inlinkScore=node.getInlinkScore();
      datum.setScore(inlinkScore);
      LOG.debug(url + ": setting to score " + inlinkScore);
    }
 else {
      datum.setScore(clearScore);
      LOG.debug(url + ": setting to clear score of " + clearScore);
    }
    output.collect(key,datum);
  }
 else {
    LOG.debug(url + ": no datum");
  }
}

public void reduce ( Text key , Iterator < ObjectWritable > values , OutputCollector < Text , CrawlDatum > output , Reporter reporter ) throws IOException { String url = key . toString ( ) ; Node node = null ; CrawlDatum datum = null ; while ( values . hasNext ( ) ) { ObjectWritable next = values . next ( ) ; Object value = next . get ( ) ; if ( value instanceof Node ) { node = ( Node ) value ; } else if ( value instanceof CrawlDatum ) { datum = ( CrawlDatum ) value ; } } if ( datum != null ) { if ( node != null ) { float inlinkScore = node . getInlinkScore ( ) ; datum . setScore ( inlinkScore ) ; LOG . debug ( url + ": setting to score " + inlinkScore ) ; } else { datum . setScore ( clearScore ) ; LOG . debug ( url + ": setting to clear score of " + clearScore ) ; } output . collect ( key , datum ) ; } else { LOG . debug ( url + ": no datum" ) ; } }
creates new crawldatum objects with the updated score from the nodedb or with a cleared score .
