// vectors, etc.):
for(int i=0;i<numDocFields;i++) {
Fieldable field = (Fieldable) docFields.get(i);
FieldInfo fi = fieldInfos.add(field.name(), field.isIndexed(), field.isTermVectorStored(),
field.isStorePositionWithTermVector(), field.isStoreOffsetWithTermVector(),
field.getOmitNorms(), false);
if (fi.isIndexed() && !fi.getOmitNorms()) {
// Maybe grow our buffered norms
if (norms.length <= fi.getNum()) {
int newSize = (int) ((1+fi.getNum())*1.25);
BufferedNorms[] newNorms = new BufferedNorms[newSize];
System.arraycopy(norms, 0, newNorms, 0, norms.length);
norms = newNorms;
}
if (norms[fi.getNum()] == null)
norms[fi.getNum()] = new BufferedNorms();
hasNorms = true;
}
// Make sure we have a FieldData allocated
int hashPos = fi.getName().hashCode() & fieldDataHashMask;
FieldData fp = fieldDataHash[hashPos];
while(fp != null && !fp.fieldInfo.getName().equals(fi.getName()))
fp = fp.next;
if (fp == null) {
fp = new FieldData(fi);
fp.next = fieldDataHash[hashPos];
fieldDataHash[hashPos] = fp;
if (numAllFieldData == allFieldDataArray.length) {
int newSize = (int) (allFieldDataArray.length*1.5);
int newHashSize = fieldDataHash.length*2;
FieldData newArray[] = new FieldData[newSize];
FieldData newHashArray[] = new FieldData[newHashSize];
System.arraycopy(allFieldDataArray, 0, newArray, 0, numAllFieldData);
// Rehash
fieldDataHashMask = newSize-1;
for(int j=0;j<fieldDataHash.length;j++) {
FieldData fp0 = fieldDataHash[j];
while(fp0 != null) {
hashPos = fp0.fieldInfo.getName().hashCode() & fieldDataHashMask;
FieldData nextFP0 = fp0.next;
fp0.next = newHashArray[hashPos];
newHashArray[hashPos] = fp0;
fp0 = nextFP0;
}
}
allFieldDataArray = newArray;
fieldDataHash = newHashArray;
}
allFieldDataArray[numAllFieldData++] = fp;
} else {
assert fp.fieldInfo == fi;
}
if (thisFieldGen != fp.lastGen) {
// First time we're seeing this field for this doc
fp.lastGen = thisFieldGen;
fp.fieldCount = 0;
fp.doVectors = fp.doVectorPositions = fp.doVectorOffsets = false;
fp.doNorms = fi.isIndexed() && !fi.getOmitNorms();
if (numFieldData == fieldDataArray.length) {
int newSize = fieldDataArray.length*2;
FieldData newArray[] = new FieldData[newSize];
System.arraycopy(fieldDataArray, 0, newArray, 0, numFieldData);