mirror of https://github.com/apache/lucene.git
LUCENE-4055: enforce that omitNorms implies normType == null
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4055@1341475 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6fef20d76a
commit
c510b3b2b9
|
@ -94,7 +94,6 @@ public final class FieldInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkConsistency() {
|
private boolean checkConsistency() {
|
||||||
// nocommit more checks here
|
|
||||||
if (!indexed) {
|
if (!indexed) {
|
||||||
assert !storeTermVector;
|
assert !storeTermVector;
|
||||||
assert !storePayloads;
|
assert !storePayloads;
|
||||||
|
@ -103,6 +102,9 @@ public final class FieldInfo {
|
||||||
assert indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
|
assert indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
|
||||||
} else {
|
} else {
|
||||||
assert indexOptions != null;
|
assert indexOptions != null;
|
||||||
|
if (omitNorms) {
|
||||||
|
assert normType == null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cannot store payloads unless positions are indexed:
|
// Cannot store payloads unless positions are indexed:
|
||||||
|
@ -126,6 +128,7 @@ public final class FieldInfo {
|
||||||
}
|
}
|
||||||
if (this.omitNorms != omitNorms) {
|
if (this.omitNorms != omitNorms) {
|
||||||
this.omitNorms = true; // if one require omitNorms at least once, it remains off for life
|
this.omitNorms = true; // if one require omitNorms at least once, it remains off for life
|
||||||
|
this.normType = null;
|
||||||
}
|
}
|
||||||
if (this.indexOptions != indexOptions) {
|
if (this.indexOptions != indexOptions) {
|
||||||
// downgrade
|
// downgrade
|
||||||
|
@ -199,7 +202,7 @@ public final class FieldInfo {
|
||||||
* @return true if this field actually has any norms.
|
* @return true if this field actually has any norms.
|
||||||
*/
|
*/
|
||||||
public boolean hasNorms() {
|
public boolean hasNorms() {
|
||||||
return indexed && !omitNorms && normType != null;
|
return normType != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -278,7 +278,7 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
||||||
if (docValues != null) {
|
if (docValues != null) {
|
||||||
fi.setDocValuesType(docValues);
|
fi.setDocValuesType(docValues);
|
||||||
}
|
}
|
||||||
if (normType != null) {
|
if (!fi.omitsNorms() && normType != null) {
|
||||||
fi.setNormValueType(normType);
|
fi.setNormValueType(normType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,7 +239,7 @@ final class SegmentMerger {
|
||||||
} else {
|
} else {
|
||||||
assert promoter != TypePromoter.getIdentityPromoter();
|
assert promoter != TypePromoter.getIdentityPromoter();
|
||||||
if (norms) {
|
if (norms) {
|
||||||
if (fi.getNormType() != promoter.type()) {
|
if (fi.getNormType() != promoter.type() && !fi.omitsNorms()) {
|
||||||
// reset the type if we got promoted
|
// reset the type if we got promoted
|
||||||
fi.setNormValueType(promoter.type());
|
fi.setNormValueType(promoter.type());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue