LUCENE-9135: Make UniformSplit FieldMetadata counters long.

Closes #1168
This commit is contained in:
Bruno Roustant 2020-01-14 16:49:52 +01:00
parent 6244b7150e
commit 8894babd4a
No known key found for this signature in database
GPG Key ID: CD28DABB95360525
2 changed files with 14 additions and 12 deletions

View File

@ -145,6 +145,8 @@ Bug Fixes
* LUCENE-9144: Fix error message on OneDimensionBKDWriter when too many points are added to the writer.
(Ignacio Vera)
* LUCENE-9135: Make UniformSplit FieldMetadata counters long. (Bruno Roustant)
Other
---------------------

View File

@ -47,9 +47,9 @@ public class FieldMetadata implements Accountable {
protected final boolean isMutable;
protected final FixedBitSet docsSeen;
protected int sumDocFreq;
protected int numTerms;
protected int sumTotalTermFreq;
protected long sumDocFreq;
protected long numTerms;
protected long sumTotalTermFreq;
protected int docCount;
protected long dictionaryStartFP;
@ -118,15 +118,15 @@ public class FieldMetadata implements Accountable {
return fieldInfo;
}
public int getSumDocFreq() {
public long getSumDocFreq() {
return sumDocFreq;
}
public int getNumTerms() {
public long getNumTerms() {
return numTerms;
}
public int getSumTotalTermFreq() {
public long getSumTotalTermFreq() {
return sumTotalTermFreq;
}
@ -214,12 +214,12 @@ public class FieldMetadata implements Accountable {
output.writeVInt(fieldMetadata.fieldInfo.number);
output.writeVInt(fieldMetadata.numTerms);
output.writeVInt(fieldMetadata.sumDocFreq);
output.writeVLong(fieldMetadata.numTerms);
output.writeVLong(fieldMetadata.sumDocFreq);
if (fieldMetadata.fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS) >= 0) {
assert fieldMetadata.sumTotalTermFreq >= fieldMetadata.sumDocFreq : "sumTotalFQ: " + fieldMetadata.sumTotalTermFreq + " sumDocFQ: " + fieldMetadata.sumDocFreq;
output.writeVInt(fieldMetadata.sumTotalTermFreq - fieldMetadata.sumDocFreq);
output.writeVLong(fieldMetadata.sumTotalTermFreq - fieldMetadata.sumDocFreq);
}
output.writeVInt(fieldMetadata.getDocCount());
@ -244,15 +244,15 @@ public class FieldMetadata implements Accountable {
}
FieldMetadata fieldMetadata = new FieldMetadata(fieldInfo, 0, false);
fieldMetadata.numTerms = input.readVInt();
fieldMetadata.numTerms = input.readVLong();
if (fieldMetadata.numTerms <= 0) {
throw new CorruptIndexException("Illegal number of terms= " + fieldMetadata.numTerms + " for field= " + fieldId, input);
}
fieldMetadata.sumDocFreq = input.readVInt();
fieldMetadata.sumDocFreq = input.readVLong();
fieldMetadata.sumTotalTermFreq = fieldMetadata.sumDocFreq;
if (fieldMetadata.fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS) >= 0) {
fieldMetadata.sumTotalTermFreq += input.readVInt();
fieldMetadata.sumTotalTermFreq += input.readVLong();
if (fieldMetadata.sumTotalTermFreq < fieldMetadata.sumDocFreq) {
// #positions must be >= #postings.
throw new CorruptIndexException("Illegal sumTotalTermFreq= " + fieldMetadata.sumTotalTermFreq