You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2021/12/02 10:29:46 UTC
[lucene] branch main updated: improve term vector merging tests (#500)
This is an automated email from the ASF dual-hosted git repository.
rmuir pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new d74255a improve term vector merging tests (#500)
d74255a is described below
commit d74255a96c32f583a81941b7cf14c53bf39e85b1
Author: Robert Muir <rm...@apache.org>
AuthorDate: Thu Dec 2 05:29:41 2021 -0500
improve term vector merging tests (#500)
Use less iterations locally so that term vector merging doesn't dominate
the list of slowest tests.
Split out deletes/no-deletes into separate methods to improve
debuggability.
Remove nightly from SimpleText term vectors merging tests, now that they
run much faster.
---
.../simpletext/TestSimpleTextTermVectorsFormat.java | 16 ----------------
.../lucene/index/BaseTermVectorsFormatTestCase.java | 20 +++++++++++++++-----
2 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/lucene/codecs/src/test/org/apache/lucene/codecs/simpletext/TestSimpleTextTermVectorsFormat.java b/lucene/codecs/src/test/org/apache/lucene/codecs/simpletext/TestSimpleTextTermVectorsFormat.java
index 45719f0..b2ebc21 100644
--- a/lucene/codecs/src/test/org/apache/lucene/codecs/simpletext/TestSimpleTextTermVectorsFormat.java
+++ b/lucene/codecs/src/test/org/apache/lucene/codecs/simpletext/TestSimpleTextTermVectorsFormat.java
@@ -16,10 +16,8 @@
*/
package org.apache.lucene.codecs.simpletext;
-import java.io.IOException;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.index.BaseTermVectorsFormatTestCase;
-import org.apache.lucene.util.LuceneTestCase;
public class TestSimpleTextTermVectorsFormat extends BaseTermVectorsFormatTestCase {
@Override
@@ -31,18 +29,4 @@ public class TestSimpleTextTermVectorsFormat extends BaseTermVectorsFormatTestCa
protected Codec getCodec() {
return new SimpleTextCodec();
}
-
- // TODO: can we speed up the underlying base test?
- @Override
- @LuceneTestCase.Nightly
- public void testMergeWithIndexSort() throws IOException {
- super.testMergeWithIndexSort();
- }
-
- // TODO: can we speed up the underlying base test?
- @Override
- @LuceneTestCase.Nightly
- public void testMergeWithoutIndexSort() throws IOException {
- super.testMergeWithoutIndexSort();
- }
}
diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java
index 7b7bd48..114ea1f 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java
@@ -676,7 +676,7 @@ public abstract class BaseTermVectorsFormatTestCase extends BaseIndexFileFormatT
private void doTestMerge(Sort indexSort, boolean allowDeletes) throws IOException {
final RandomDocumentFactory docFactory = new RandomDocumentFactory(5, 20);
- final int numDocs = atLeast(100);
+ final int numDocs = TEST_NIGHTLY ? atLeast(100) : atLeast(10);
for (Options options : validOptions()) {
Map<String, RandomDocument> docs = new HashMap<>();
for (int i = 0; i < numDocs; ++i) {
@@ -750,18 +750,28 @@ public abstract class BaseTermVectorsFormatTestCase extends BaseIndexFileFormatT
}
}
+ public void testMerge() throws IOException {
+ doTestMerge(null, false);
+ }
+
+ public void testMergeWithDeletes() throws IOException {
+ doTestMerge(null, true);
+ }
+
public void testMergeWithIndexSort() throws IOException {
SortField[] sortFields = new SortField[TestUtil.nextInt(random(), 1, 2)];
for (int i = 0; i < sortFields.length; i++) {
sortFields[i] = new SortField("sort_field_" + i, SortField.Type.LONG);
}
doTestMerge(new Sort(sortFields), false);
- doTestMerge(new Sort(sortFields), true);
}
- public void testMergeWithoutIndexSort() throws IOException {
- doTestMerge(null, false);
- doTestMerge(null, true);
+ public void testMergeWithIndexSortAndDeletes() throws IOException {
+ SortField[] sortFields = new SortField[TestUtil.nextInt(random(), 1, 2)];
+ for (int i = 0; i < sortFields.length; i++) {
+ sortFields[i] = new SortField("sort_field_" + i, SortField.Type.LONG);
+ }
+ doTestMerge(new Sort(sortFields), true);
}
// run random tests from different threads to make sure the per-thread clones