code: func (ix *IndexWriter) mergePost(out *bufWriter) {
  	var h postHeap
  
  	log.Printf("merge %d files + mem", len(ix.postFile))
  	for _, f := range ix.postFile {
  		h.addFile(f)
  	}
  	sortPost(ix.post)
  	h.addMem(ix.post)
  
  	npost := 0
  	e := h.next()
  	offset0 := out.offset()
  	for {
  		npost++
  		offset := out.offset() - offset0
  		trigram := e.trigram()
  		ix.buf[0] = byte(trigram >> 16)
  		ix.buf[1] = byte(trigram >> 8)
  		ix.buf[2] = byte(trigram)
  
  		// posting list
  		fileid := ^uint32(0)
  		nfile := uint32(0)
  		out.write(ix.buf[:3])
  		for ; e.trigram() == trigram && trigram != 1<<24-1; e = h.next() {
  			out.writeUvarint(e.fileid() - fileid)
  			fileid = e.fileid()
  			nfile++
  		}
  		out.writeUvarint(0)
  
  		// index entry
  		ix.postIndex.write(ix.buf[:3])
  		ix.postIndex.writeUint32(nfile)
  		ix.postIndex.writeUint32(offset)
  
  		if trigram == 1<<24-1 {
  			break
  		}
  	}
  }
docs: // mergePost reads the flushed index entries and merges them
  // into posting lists, writing the resulting lists to out.