/** * Writes the contents of the postings in memory to disk. * @param writer The RunWriter to write the postings to. * @param postings the Map<String,Posting> containing the posting lists in memory. * @throws IOException if an I/O error occurs. */ private void writeToWriter(RunWriter writer, Map<String, Posting> _postings) throws IOException{ if (_postings.size() != 0){ writer.beginWrite(maxSize, _postings.size()); for( Entry<String,Posting> entry : _postings.entrySet()) { writer.writeTerm(entry.getKey(), entry.getValue()); } } writer.finishWrite(); } }