mirror of https://github.com/apache/lucene.git
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:
parent
2f501094e4
commit
5fce870b63
|
@ -107,7 +107,7 @@ class Lucene3xFieldInfosReader extends FieldInfosReader {
|
||||||
hasProx |= isIndexed && indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
|
hasProx |= isIndexed && indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
|
||||||
hasFreq |= isIndexed && indexOptions != IndexOptions.DOCS_ONLY;
|
hasFreq |= isIndexed && indexOptions != IndexOptions.DOCS_ONLY;
|
||||||
infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector,
|
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()) {
|
if (input.getFilePointer() != input.length()) {
|
||||||
|
|
|
@ -652,10 +652,16 @@ public class CheckIndex {
|
||||||
infoStream.print(" test: field norms.........");
|
infoStream.print(" test: field norms.........");
|
||||||
}
|
}
|
||||||
DocValues dv;
|
DocValues dv;
|
||||||
|
// todo: factor out a shared checkValues(DocValues, Type (from fieldinfos), ...) and share this method
|
||||||
|
// between this and testDocValues
|
||||||
for (FieldInfo info : fieldInfos) {
|
for (FieldInfo info : fieldInfos) {
|
||||||
if (reader.hasNorms(info.name)) {
|
if (reader.hasNorms(info.name)) {
|
||||||
dv = reader.normValues(info.name);
|
dv = reader.normValues(info.name);
|
||||||
assert dv != null;
|
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()) {
|
if (dv.getSource().hasArray()) {
|
||||||
Object array = dv.getSource().getArray();
|
Object array = dv.getSource().getArray();
|
||||||
if (Array.getLength(array) != reader.maxDoc()) {
|
if (Array.getLength(array) != reader.maxDoc()) {
|
||||||
|
|
Loading…
Reference in New Issue