*/
InvertedIndex invertedIndex = index.getInvertedIndex();
assertNotNull(invertedIndex);
// for each term
for (int t = 0; t < termStrings.length; t++) {
LexiconEntry le = lexicon.getLexiconEntry(termStrings[t]);
assertNotNull(le);
ip = invertedIndex.getPostings((BitIndexPointer) le);
// for each document
int d = 0;
while (ip.next() != IterablePosting.EOL) {
assertEquals(invIds[t][d], ip.getId());
assertEquals(invTfs[t][d], ip.getFrequency());
assertEquals(doclens[invIds[t][d]], ip.getDocumentLength());
if (fieldsExpected) {
assertEquals(2, invFfs[t][d].length);
for (int f = 0; f < 2; f++) {
assertEquals(invFfs[t][d][f], ((FieldIterablePosting) ip).getFieldFrequencies()[f]);
}
}
d++;
}
ip.close();
}
// post-check
assertEquals(IterablePosting.EOL, ip.next());
/**
* Test {@link IterablePosting} entries from a {@link InvertedIndexInputStream}
*/
bpiis = (BitPostingIndexInputStream) index.getIndexStructureInputStream("inverted");
assertNotNull(bpiis);
// for each term
for (int t = 0; t < invIds.length; t++) {
assertTrue(bpiis.hasNext());
ip = bpiis.next();
assertNotNull(ip);
// for each document
int d = 0;
while (ip.next() != IterablePosting.EOL) {
assertEquals(invIds[t][d], ip.getId());
assertEquals(invTfs[t][d], ip.getFrequency());
assertEquals(doclens[invIds[t][d]], ip.getDocumentLength());
if (fieldsExpected) {
assertEquals(2, invFfs[t][d].length);
for (int f = 0; f < 2; f++) {
assertEquals(invFfs[t][d][f], ((FieldIterablePosting) ip).getFieldFrequencies()[f]);
}
}
d++;
}
}
// post-check
assertFalse(bpiis.hasNext());
/**
* Test posting array entries from a {@link InvertedIndex}
*/
// for each term
for (int t = 0; t < termStrings.length; t++) {
LexiconEntry le = lexicon.getLexiconEntry(termStrings[t]);
assertNotNull(le);
int[][] documents = invertedIndex.getDocuments(le);
if (!fieldsExpected) {