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();
|
||||
docValuesType.clear();
|
||||
}
|
||||
|
||||
synchronized void setDocValuesType(int number, String name, DocValuesType dvType) {
|
||||
assert containsConsistent(number, name, dvType);
|
||||
docValuesType.put(name, dvType);
|
||||
}
|
||||
}
|
||||
|
||||
static final class Builder {
|
||||
|
@ -287,9 +292,14 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
|||
fi.update(isIndexed, storeTermVector, omitNorms, storePayloads, indexOptions);
|
||||
|
||||
if (docValues != null) {
|
||||
fi.setDocValuesType(docValues);
|
||||
// must also update docValuesType map so it's aware of this field's DocValueType
|
||||
globalFieldNumbers.docValuesType.put(name, docValues);
|
||||
// only pay the synchronization cost if fi does not already have a DVType
|
||||
boolean updateGlobal = !fi.hasDocValues();
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue