/** Add the specified to the term posting to the memory postings. * @param term The String form of the term * @param doc the document id of the doc * @param frequency the frequency of the specified term in the document * @param blocks the blockids at which this term occurs */ public void add(String term, int doc, int frequency, int[] blocks) throws IOException{ BlockPosting post; if((post =(BlockPosting) postings.get(term)) != null) { valueBytes += post.insert(doc, frequency, blocks); int tf = post.getTF(); // Update the max size if(maxSize < tf) maxSize = tf; } else{ post = new BlockPosting(); valueBytes += post.writeFirstDoc(doc, frequency, blocks); postings.put(term,post); keyBytes += (long)(12 + 2*term.length()); } numPointers++; } }