Skip to content

Apache Lucene open-source search software

Speed up some slow tests by reducing iteration counts (addresses #15212) (#15214)

Michael Sokolova5a7e3417fb9
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestFullPrecisionFloatVectorSimilarityValuesSource.java b/lucene/core/src/test/org/apache/lucene/search/TestFullPrecisionFloatVectorSimilarityValuesSource.java
index 59df35514f4..b849bd2a8fc 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestFullPrecisionFloatVectorSimilarityValuesSource.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestFullPrecisionFloatVectorSimilarityValuesSource.java
@@ -46,8 +46,8 @@ public class TestFullPrecisionFloatVectorSimilarityValuesSource extends LuceneTe
private Codec savedCodec;
private static final String KNN_FIELD = "knnField";
- private static final int NUM_VECTORS = 1000;
- private static final int VECTOR_DIMENSION = 128;
+ private static final int NUM_VECTORS = 100;
+ private static final int VECTOR_DIMENSION = 8;
KnnVectorsFormat format;
Float confidenceInterval;
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestLateInteractionFloatValuesSource.java b/lucene/core/src/test/org/apache/lucene/search/TestLateInteractionFloatValuesSource.java
index 2f757b9b236..2fe368fa79c 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestLateInteractionFloatValuesSource.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestLateInteractionFloatValuesSource.java
@@ -66,7 +66,7 @@ public class TestLateInteractionFloatValuesSource extends LuceneTestCase {
public void testValues() throws IOException {
List<float[][]> corpus = new ArrayList<>();
- final int numDocs = atLeast(1000);
+ final int numDocs = atLeast(100);
final int numSegments = random().nextInt(2, 5);
final VectorSimilarityFunction vectorSimilarityFunction =
VectorSimilarityFunction.values()[
@@ -96,7 +96,7 @@ public class TestLateInteractionFloatValuesSource extends LuceneTestCase {
}
}
// add a segment with no vectors
- for (int i = 0; i < 100; i++) {
+ for (int i = 0; i < 10; i++) {
Document doc = new Document();
doc.add(new IntField("has_li_vector", 0, Field.Store.YES));
w.addDocument(doc);
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestLateInteractionRescorer.java b/lucene/core/src/test/org/apache/lucene/search/TestLateInteractionRescorer.java
index 6f3784c3c2f..6c018ad2684 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestLateInteractionRescorer.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestLateInteractionRescorer.java
@@ -130,7 +130,7 @@ public class TestLateInteractionRescorer extends LuceneTestCase {
}
private void indexMultiVectors(Directory dir, List<float[][]> corpus) throws IOException {
- final int numDocs = atLeast(1000);
+ final int numDocs = atLeast(100);
final int numSegments = random().nextInt(2, 5);
int id = 0;
try (IndexWriter w = new IndexWriter(dir, newIndexWriterConfig())) {
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestRescoreTopNQuery.java b/lucene/core/src/test/org/apache/lucene/search/TestRescoreTopNQuery.java
index df21442e2b5..e7dea987816 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestRescoreTopNQuery.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestRescoreTopNQuery.java
@@ -167,9 +167,9 @@ public class TestRescoreTopNQuery extends LuceneTestCase {
final String LATE_I_FIELD = "li_vector";
final String KNN_FIELD = "knn_vector";
List<float[][]> corpus = new ArrayList<>();
- final int numDocs = atLeast(1000);
- final int numSegments = random().nextInt(2, 10);
- final int dim = 128;
+ final int numDocs = atLeast(100);
+ final int numSegments = random().nextInt(2, 5);
+ final int dim = 8;
final VectorSimilarityFunction vectorSimilarityFunction =
VectorSimilarityFunction.values()[
random().nextInt(VectorSimilarityFunction.values().length)];