//finished with index file
dis.close();
} catch (OutOfMemoryError oome) {
//logger.warn("OutOfMemoryError: Structure "+ structureName + " reading lookup file directly from disk");
//logger.debug("Metadata lookup will be read directly from disk: "+ length +" entries, size "+ dataFileLength + " bytes");
RandomDataInput rfi = Files.openFileRandom(indexFilename);
offsetLookup = new OnDiskDocid2OffsetLookup(
rfi instanceof RandomAccessFile
? new ChannelByteAccessor((RandomAccessFile)rfi)
: new RandomDataInputAccessor(rfi),
length, dataFileLength
);
}
}
else
{
try{
DataInputStream dis = new DataInputStream(Files.openFileStream(indexFilename));
offsetLookup = new OnDiskDocid2OffsetLookup(new RandomDataInputAccessor(new RandomDataInputMemory(dis, indexFileLength)),length, dataFileLength);
dis.close();
}
catch (OutOfMemoryError oome) {
//logger.warn("OutOfMemoryError: Structure "+ structureName + " reading lookup file directly from disk");
//logger.debug("Metadata lookup will be read directly from disk: "+ length +" entries, size "+ dataFileLength + " bytes");
RandomDataInput rfi = Files.openFileRandom(indexFilename);
offsetLookup = new OnDiskDocid2OffsetLookup(
rfi instanceof RandomAccessFile
? new ChannelByteAccessor((RandomAccessFile)rfi)
: new RandomDataInputAccessor(rfi),
length, dataFileLength
);
}
}
} else {
//logger.warn("Structure "+ structureName + " reading lookup file directly from disk (SLOW)");
//logger.debug("Metadata lookup will be read directly from disk: "+ length +" entries, size "+ dataFileLength + " bytes");
RandomDataInput rfi = Files.openFileRandom(indexFilename);
offsetLookup = new OnDiskDocid2OffsetLookup(
rfi instanceof RandomAccessFile
? new ChannelByteAccessor((RandomAccessFile)rfi)
: new RandomDataInputAccessor(rfi),
length, dataFileLength