LUCENE-3860: 3.x indexes have the wrong normType set in fieldinfos

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1299375 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-03-11 15:18:29 +00:00
parent 2f501094e4
commit 5fce870b63
2 changed files with 7 additions and 1 deletions

View File

@ -107,7 +107,7 @@ class Lucene3xFieldInfosReader extends FieldInfosReader {
hasProx |= isIndexed && indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
hasFreq |= isIndexed && indexOptions != IndexOptions.DOCS_ONLY;
infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector,
omitNorms, storePayloads, indexOptions, null, isIndexed && !omitNorms? Type.BYTES_VAR_STRAIGHT : null);
omitNorms, storePayloads, indexOptions, null, isIndexed && !omitNorms? Type.FIXED_INTS_8 : null);
}
if (input.getFilePointer() != input.length()) {

View File

@ -652,10 +652,16 @@ public class CheckIndex {
infoStream.print(" test: field norms.........");
}
DocValues dv;
// todo: factor out a shared checkValues(DocValues, Type (from fieldinfos), ...) and share this method
// between this and testDocValues
for (FieldInfo info : fieldInfos) {
if (reader.hasNorms(info.name)) {
dv = reader.normValues(info.name);
assert dv != null;
DocValues.Type type = dv.type();
if (type != info.getNormType()) {
throw new RuntimeException("field: " + info.name + " has type: " + type + " but fieldInfos says:" + info.getNormType());
}
if (dv.getSource().hasArray()) {
Object array = dv.getSource().getArray();
if (Array.getLength(array) != reader.maxDoc()) {