mirror of https://github.com/apache/lucene.git
LUCENE-5192: use syn'd method to set field's DV type
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1518936 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2f99004faf
commit
da8ab682c6
|
@ -228,6 +228,11 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
||||||
nameToNumber.clear();
|
nameToNumber.clear();
|
||||||
docValuesType.clear();
|
docValuesType.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized void setDocValuesType(int number, String name, DocValuesType dvType) {
|
||||||
|
assert containsConsistent(number, name, dvType);
|
||||||
|
docValuesType.put(name, dvType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class Builder {
|
static final class Builder {
|
||||||
|
@ -287,9 +292,14 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
||||||
fi.update(isIndexed, storeTermVector, omitNorms, storePayloads, indexOptions);
|
fi.update(isIndexed, storeTermVector, omitNorms, storePayloads, indexOptions);
|
||||||
|
|
||||||
if (docValues != null) {
|
if (docValues != null) {
|
||||||
fi.setDocValuesType(docValues);
|
// only pay the synchronization cost if fi does not already have a DVType
|
||||||
// must also update docValuesType map so it's aware of this field's DocValueType
|
boolean updateGlobal = !fi.hasDocValues();
|
||||||
globalFieldNumbers.docValuesType.put(name, docValues);
|
fi.setDocValuesType(docValues); // this will also perform the consistency check.
|
||||||
|
if (updateGlobal) {
|
||||||
|
// must also update docValuesType map so it's
|
||||||
|
// aware of this field's DocValueType
|
||||||
|
globalFieldNumbers.setDocValuesType(fi.number, name, docValues);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fi.omitsNorms() && normType != null) {
|
if (!fi.omitsNorms() && normType != null) {
|
||||||
|
|
Loading…
Reference in New Issue