throw new FieldReaderException("Invalid numeric type: " + Integer.toHexString(numeric));
}
}
private void addFieldLazy(Document doc, FieldInfo fi, boolean binary, boolean compressed, boolean tokenize, boolean cacheResult, int numeric) throws IOException {
final AbstractField f;
if (binary) {
int toRead = fieldsStream.readVInt();
long pointer = fieldsStream.getFilePointer();
f = new LazyField(fi.name, Field.Store.YES, toRead, pointer, binary, compressed, cacheResult);
//Need to move the pointer ahead by toRead positions
// fieldsStream.seek(pointer + toRead);
fieldsStream.seek(pointer);
byte[] skip=new byte[toRead];
fieldsStream.readBytes(skip,0,toRead);
} else if (numeric != 0) {
f = loadNumericField(fi, numeric);
} else {
Field.Store store = Field.Store.YES;
Field.Index index = Field.Index.toIndex(fi.isIndexed, tokenize);
Field.TermVector termVector = Field.TermVector.toTermVector(fi.storeTermVector, fi.storeOffsetWithTermVector, fi.storePositionWithTermVector);
if (compressed) {
int toRead = fieldsStream.readVInt();
long pointer = fieldsStream.getFilePointer();
f = new LazyField(fi.name, store, toRead, pointer, binary, compressed, cacheResult);
//skip over the part that we aren't loading
// fieldsStream.seek(pointer + toRead);
fieldsStream.seek(pointer);
byte[] skip=new byte[toRead];
fieldsStream.readBytes(skip,0,toRead);
} else {
int length = fieldsStream.readVInt();
long pointer = fieldsStream.getFilePointer();
//Skip ahead of where we are by the length of what is stored
if (format >= FieldsWriter.FORMAT_VERSION_UTF8_LENGTH_IN_BYTES) {
// fieldsStream.seek(pointer+length);
fieldsStream.seek(pointer);
byte[] skip=new byte[length];
fieldsStream.readBytes(skip,0,length);
} else {
fieldsStream.skipChars(length);
}
f = new LazyField(fi.name, store, index, termVector, length, pointer, binary, compressed, cacheResult);
}
}
f.setOmitNorms(fi.omitNorms);
f.setIndexOptions(fi.indexOptions);
doc.add(f);
}