public void reduce(IntWritable key, Iterator<PairOfFloatInt> values,
OutputCollector<PairOfInts, Text> output, Reporter reporter)
throws IOException {
list.clear();
while(values.hasNext()){
PairOfFloatInt p = values.next();
list.add(new PairOfFloatInt(p.getLeftElement(), p.getRightElement()));
reporter.incrCounter(mapoutput.count, 1);
}
int cntr = 0;
while(!list.isEmpty() && cntr<numResults){
PairOfFloatInt pair = list.pollLast();
sLogger.debug("output " + cntr + "=" + pair);
keyOut.set(pair.getRightElement(), key.get()); //first english docno, then foreign language docno
valOut.set(nf.format(pair.getLeftElement()));
output.collect(keyOut, valOut);
cntr++;
}
}