mirror of https://github.com/apache/lucene.git
LUCENE-5689: FieldInfo.setDocValuesGen should not be public
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1596553 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
71d836b713
commit
d1e607f5df
|
@ -125,8 +125,7 @@ public class SimpleTextFieldInfosReader extends FieldInfosReader {
|
|||
}
|
||||
|
||||
infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector,
|
||||
omitNorms, storePayloads, indexOptions, docValuesType, normsType, Collections.unmodifiableMap(atts));
|
||||
infos[i].setDocValuesGen(dvGen);
|
||||
omitNorms, storePayloads, indexOptions, docValuesType, normsType, dvGen, Collections.unmodifiableMap(atts));
|
||||
}
|
||||
|
||||
SimpleTextUtil.checkFooter(input);
|
||||
|
|
|
@ -104,7 +104,7 @@ class Lucene40FieldInfosReader extends FieldInfosReader {
|
|||
attributes.put(LEGACY_NORM_TYPE_KEY, oldNormsType.name());
|
||||
}
|
||||
infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector,
|
||||
omitNorms, storePayloads, indexOptions, oldValuesType.mapping, oldNormsType.mapping, Collections.unmodifiableMap(attributes));
|
||||
omitNorms, storePayloads, indexOptions, oldValuesType.mapping, oldNormsType.mapping, -1, Collections.unmodifiableMap(attributes));
|
||||
}
|
||||
|
||||
CodecUtil.checkEOF(input);
|
||||
|
|
|
@ -89,7 +89,7 @@ final class Lucene42FieldInfosReader extends FieldInfosReader {
|
|||
final DocValuesType normsType = getDocValuesType(input, (byte) ((val >>> 4) & 0x0F));
|
||||
final Map<String,String> attributes = input.readStringStringMap();
|
||||
infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector,
|
||||
omitNorms, storePayloads, indexOptions, docValuesType, normsType, Collections.unmodifiableMap(attributes));
|
||||
omitNorms, storePayloads, indexOptions, docValuesType, normsType, -1, Collections.unmodifiableMap(attributes));
|
||||
}
|
||||
|
||||
CodecUtil.checkEOF(input);
|
||||
|
|
|
@ -89,8 +89,7 @@ final class Lucene46FieldInfosReader extends FieldInfosReader {
|
|||
final long dvGen = input.readLong();
|
||||
final Map<String,String> attributes = input.readStringStringMap();
|
||||
infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector,
|
||||
omitNorms, storePayloads, indexOptions, docValuesType, normsType, Collections.unmodifiableMap(attributes));
|
||||
infos[i].setDocValuesGen(dvGen);
|
||||
omitNorms, storePayloads, indexOptions, docValuesType, normsType, dvGen, Collections.unmodifiableMap(attributes));
|
||||
}
|
||||
|
||||
if (codecVersion >= Lucene46FieldInfosFormat.FORMAT_CHECKSUM) {
|
||||
|
|
|
@ -47,7 +47,7 @@ public final class FieldInfo {
|
|||
|
||||
private Map<String,String> attributes;
|
||||
|
||||
private long dvGen = -1; // the DocValues generation of this field
|
||||
private long dvGen;
|
||||
|
||||
/**
|
||||
* Controls how much information is stored in the postings lists.
|
||||
|
@ -121,7 +121,7 @@ public final class FieldInfo {
|
|||
*/
|
||||
public FieldInfo(String name, boolean indexed, int number, boolean storeTermVector, boolean omitNorms,
|
||||
boolean storePayloads, IndexOptions indexOptions, DocValuesType docValues, DocValuesType normsType,
|
||||
Map<String,String> attributes) {
|
||||
long dvGen, Map<String,String> attributes) {
|
||||
this.name = name;
|
||||
this.indexed = indexed;
|
||||
this.number = number;
|
||||
|
@ -139,6 +139,7 @@ public final class FieldInfo {
|
|||
this.indexOptions = null;
|
||||
this.normType = null;
|
||||
}
|
||||
this.dvGen = dvGen;
|
||||
this.attributes = attributes;
|
||||
assert checkConsistency();
|
||||
}
|
||||
|
@ -158,6 +159,10 @@ public final class FieldInfo {
|
|||
// Cannot store payloads unless positions are indexed:
|
||||
assert indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 || !this.storePayloads;
|
||||
}
|
||||
|
||||
if (dvGen != -1) {
|
||||
assert docValueType != null;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -221,8 +226,9 @@ public final class FieldInfo {
|
|||
}
|
||||
|
||||
/** Sets the docValues generation of this field. */
|
||||
public void setDocValuesGen(long dvGen) {
|
||||
void setDocValuesGen(long dvGen) {
|
||||
this.dvGen = dvGen;
|
||||
assert checkConsistency();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -302,7 +302,7 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
|||
// before then we'll get the same name and number,
|
||||
// else we'll allocate a new one:
|
||||
final int fieldNumber = globalFieldNumbers.addOrGet(name, preferredFieldNumber, docValues);
|
||||
fi = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, omitNorms, storePayloads, indexOptions, docValues, normType, null);
|
||||
fi = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, omitNorms, storePayloads, indexOptions, docValues, normType, -1, null);
|
||||
assert !byName.containsKey(fi.name);
|
||||
assert globalFieldNumbers.containsConsistent(Integer.valueOf(fi.number), fi.name, fi.getDocValuesType());
|
||||
byName.put(fi.name, fi);
|
||||
|
|
|
@ -448,7 +448,7 @@ public class MemoryIndex {
|
|||
|
||||
if (!fieldInfos.containsKey(fieldName)) {
|
||||
fieldInfos.put(fieldName,
|
||||
new FieldInfo(fieldName, true, fieldInfos.size(), false, false, false, this.storeOffsets ? IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS , null, null, null));
|
||||
new FieldInfo(fieldName, true, fieldInfos.size(), false, false, false, this.storeOffsets ? IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS , null, null, -1, null));
|
||||
}
|
||||
TermToBytesRefAttribute termAtt = stream.getAttribute(TermToBytesRefAttribute.class);
|
||||
PositionIncrementAttribute posIncrAttribute = stream.addAttribute(PositionIncrementAttribute.class);
|
||||
|
|
|
@ -215,7 +215,7 @@ public class UninvertingReader extends FilterAtomicReader {
|
|||
}
|
||||
}
|
||||
filteredInfos.add(new FieldInfo(fi.name, fi.isIndexed(), fi.number, fi.hasVectors(), fi.omitsNorms(),
|
||||
fi.hasPayloads(), fi.getIndexOptions(), type, fi.getNormType(), null));
|
||||
fi.hasPayloads(), fi.getIndexOptions(), type, fi.getNormType(), -1, null));
|
||||
}
|
||||
fieldInfos = new FieldInfos(filteredInfos.toArray(new FieldInfo[filteredInfos.size()]));
|
||||
}
|
||||
|
|
|
@ -357,7 +357,7 @@ public abstract class BasePostingsFormatTestCase extends BaseIndexFileFormatTest
|
|||
|
||||
fieldInfoArray[fieldUpto] = new FieldInfo(field, true, fieldUpto, false, false, true,
|
||||
IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS,
|
||||
null, DocValuesType.NUMERIC, null);
|
||||
null, DocValuesType.NUMERIC, -1, null);
|
||||
fieldUpto++;
|
||||
|
||||
SortedMap<BytesRef,Long> postings = new TreeMap<>();
|
||||
|
@ -680,6 +680,7 @@ public abstract class BasePostingsFormatTestCase extends BaseIndexFileFormatTest
|
|||
indexOptions,
|
||||
null,
|
||||
DocValuesType.NUMERIC,
|
||||
-1,
|
||||
null);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class Insanity {
|
|||
for (FieldInfo fi : in.getFieldInfos()) {
|
||||
if (fi.name.equals(insaneField)) {
|
||||
filteredInfos.add(new FieldInfo(fi.name, fi.isIndexed(), fi.number, fi.hasVectors(), fi.omitsNorms(),
|
||||
fi.hasPayloads(), fi.getIndexOptions(), null, fi.getNormType(), null));
|
||||
fi.hasPayloads(), fi.getIndexOptions(), null, fi.getNormType(), -1, null));
|
||||
} else {
|
||||
filteredInfos.add(fi);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue