}
public void testRandomDoc() throws IOException {
final int blockSize = BLOCK_SIZES[random().nextInt(BLOCK_SIZES.length)];
final DocsFreqBlockIndexOutput out = this.getIndexOutput(blockSize);
final DocsFreqBlockWriter writer = out.getBlockWriter();
writer.setNodeBlockIndex(out.index());
writer.setPosBlockIndex(out.index());
// generate doc ids
final Set<Integer> docIds = new TreeSet<Integer>();
final int lenght = (int) this.nextLong(128000, 512000);
for (int i = 0; i < lenght; i++) {
docIds.add((int) this.nextLong(0, ((1L << 31) - 1)));
}
for (final int docId : docIds) {
if (writer.isFull()) {
writer.flush();
}
writer.write(docId);
}
writer.flush(); // flush remaining data
out.close();
final DocsFreqBlockIndexInput in = this.getIndexInput();
final DocsFreqBlockReader reader = in.getBlockReader();
reader.setNodeBlockIndex(in.index());