}
}
@Override
public FieldInfos getFieldInfos() {
FieldInfos innerInfos = super.getFieldInfos();
ArrayList<FieldInfo> infos = new ArrayList<FieldInfo>(innerInfos.size());
// if there are partitions, then the source index contains one field for all their terms
// while with DocValues, we simulate that by multiple fields.
HashSet<String> leftoverFields = new HashSet<String>(fieldTerms.keySet());
int number = -1;
for (FieldInfo info : innerInfos) {
if (fieldTerms.containsKey(info.name)) {
// mark this field as having a DocValues
infos.add(new FieldInfo(info.name, true, info.number,
info.hasVectors(), info.omitsNorms(), info.hasPayloads(),
info.getIndexOptions(), DocValuesType.BINARY,
info.getNormType(), info.attributes()));
leftoverFields.remove(info.name);
} else {
infos.add(info);
}
number = Math.max(number, info.number);
}
for (String field : leftoverFields) {
infos.add(new FieldInfo(field, false, ++number, false, false, false,
null, DocValuesType.BINARY, null, null));
}
return new FieldInfos(infos.toArray(new FieldInfo[infos.size()]));
}