*/
@Override
protected void traverseDirectFile(TIntIntHashMap codesHashMap,
TIntArrayList[][] tmpStorage) throws IOException {
// scan the direct file
DirectIndexInputStream directInputStream = (DirectIndexInputStream)index.getIndexStructureInputStream("direct");
int[][] documentTerms = null;
int p = 0; // a document counter;
while ((documentTerms = directInputStream.getNextTerms()) != null) {
p += directInputStream.getEntriesSkipped();
// the two next vectors are used for reducing the number of
// references
int[] documentTerms0 = documentTerms[0];
int[] termfreqs = documentTerms[1];
int[] blockfreqs = documentTerms[fieldCount + 2];
int[] blockids = documentTerms[fieldCount + 3];
// scan the list of the j-th document's terms
final int length = documentTerms0.length;
int blockfreq;
int blockidstart;
int blockidend;
for (int k = 0; k < length; k++) {
// if the k-th term of the document is to be indexed in this
// pass
int codePairIndex = codesHashMap.get(documentTerms0[k]);
if (codePairIndex > 0) {
// need to decrease codePairIndex because it has been
// already increased while storing in codesHashMap
codePairIndex--;
TIntArrayList[] tmpMatrix = tmpStorage[codePairIndex];
tmpMatrix[0].add(p);
tmpMatrix[1].add(termfreqs[k]);
for(int fi= 0;fi<fieldCount;fi++)
{
tmpMatrix[2+fi].add(documentTerms[2+fi][k]);
}
blockfreq = blockfreqs[k];
tmpMatrix[fieldCount+2].add(blockfreq);
// computing the offsets in the
// tmpMatrix[4] of the block ids
blockidstart = 0;
if (k > 0) {
for (int l = 0; l < k; l++)
blockidstart += blockfreqs[l];
}
blockidend = blockidstart + blockfreq;
for (int l = blockidstart; l < blockidend; l++) {
tmpMatrix[fieldCount+3].add(blockids[l]);
}
}
}
p++;
}
directInputStream.close();
}