private void writeSim(SparseMatrixWriter writer, Integer wpId, TIntSet colIds, int maxSimsPerDoc, AtomicInteger idCounter, AtomicLong cellCounter) throws IOException, DaoException { if (idCounter.incrementAndGet() % 10000 == 0) { LOG.info("finding matches for page " + idCounter.get()); } SRResultList scores = mostSimilar(wpId, maxSimsPerDoc, colIds); if (scores != null) { int ids[] = scores.getIds(); cellCounter.getAndIncrement(); writer.writeRow(new SparseMatrixRow(writer.getValueConf(), wpId, ids, scores.getScoresAsFloat())); } }