/** * Begins the merge, initilialising the structures. * Notice that the file names must be in order of run-id * @param size number of runs in disk. * @param fileName String with the file name of the final inverted file. * @throws IOException if an I/O error occurs. */ protected void init(int size, String fileName) throws Exception{ this.init(size, new BitOutputStream(fileName)); }
/** * Begins the multiway merging phase. * @param size number of runs to be merged. * @param fileName output filename. * @throws Exception if an I/O error occurs. */ public void beginMerge(int size, String fileName) throws Exception{ init(size, fileName); myRun = queue.poll(); while(myRun.current().getTerm().equals(" ")) myRun = queue.poll(); lastDocument = myRun.current().append(bos,-1); termStatistics = myRun.current().getLexiconEntry(); lastFreq = myRun.current().getTF(); lastDocFreq = myRun.current().getDf(); lastTermWritten = myRun.current().getTerm(); if(myRun.hasNext()){ myRun.next(); queue.add(myRun); }else{ myRun.close(); } }