mirror of https://github.com/apache/lucene.git
LUCENE-10408 Test correction checksum (#734)
Use double instead of float to test vector values checksum
This commit is contained in:
parent
8afec33e74
commit
e5717cddfd
|
@ -594,7 +594,7 @@ public abstract class BaseKnnVectorsFormatTestCase extends BaseIndexFileFormatTe
|
||||||
int numDocs = atLeast(1000);
|
int numDocs = atLeast(1000);
|
||||||
int numFields = TestUtil.nextInt(random(), 1, 10);
|
int numFields = TestUtil.nextInt(random(), 1, 10);
|
||||||
int[] fieldDocCounts = new int[numFields];
|
int[] fieldDocCounts = new int[numFields];
|
||||||
float[] fieldTotals = new float[numFields];
|
double[] fieldTotals = new double[numFields];
|
||||||
int[] fieldDims = new int[numFields];
|
int[] fieldDims = new int[numFields];
|
||||||
VectorSimilarityFunction[] fieldSearchStrategies = new VectorSimilarityFunction[numFields];
|
VectorSimilarityFunction[] fieldSearchStrategies = new VectorSimilarityFunction[numFields];
|
||||||
for (int i = 0; i < numFields; i++) {
|
for (int i = 0; i < numFields; i++) {
|
||||||
|
@ -622,7 +622,7 @@ public abstract class BaseKnnVectorsFormatTestCase extends BaseIndexFileFormatTe
|
||||||
try (IndexReader r = w.getReader()) {
|
try (IndexReader r = w.getReader()) {
|
||||||
for (int field = 0; field < numFields; field++) {
|
for (int field = 0; field < numFields; field++) {
|
||||||
int docCount = 0;
|
int docCount = 0;
|
||||||
float checksum = 0;
|
double checksum = 0;
|
||||||
String fieldName = "int" + field;
|
String fieldName = "int" + field;
|
||||||
for (LeafReaderContext ctx : r.leaves()) {
|
for (LeafReaderContext ctx : r.leaves()) {
|
||||||
VectorValues vectors = ctx.reader().getVectorValues(fieldName);
|
VectorValues vectors = ctx.reader().getVectorValues(fieldName);
|
||||||
|
@ -1095,7 +1095,7 @@ public abstract class BaseKnnVectorsFormatTestCase extends BaseIndexFileFormatTe
|
||||||
VectorSimilarityFunction.values()[
|
VectorSimilarityFunction.values()[
|
||||||
random().nextInt(VectorSimilarityFunction.values().length)];
|
random().nextInt(VectorSimilarityFunction.values().length)];
|
||||||
|
|
||||||
float fieldValuesCheckSum = 0f;
|
double fieldValuesCheckSum = 0;
|
||||||
int fieldDocCount = 0;
|
int fieldDocCount = 0;
|
||||||
long fieldSumDocIDs = 0;
|
long fieldSumDocIDs = 0;
|
||||||
|
|
||||||
|
@ -1120,7 +1120,7 @@ public abstract class BaseKnnVectorsFormatTestCase extends BaseIndexFileFormatTe
|
||||||
}
|
}
|
||||||
|
|
||||||
try (IndexReader r = w.getReader()) {
|
try (IndexReader r = w.getReader()) {
|
||||||
float checksum = 0;
|
double checksum = 0;
|
||||||
int docCount = 0;
|
int docCount = 0;
|
||||||
long sumDocIds = 0;
|
long sumDocIds = 0;
|
||||||
for (LeafReaderContext ctx : r.leaves()) {
|
for (LeafReaderContext ctx : r.leaves()) {
|
||||||
|
|
Loading…
Reference in New Issue