Skip to content

Apache Lucene open-source search software

LUCENE-7591 - approximate to no. of terms when DVs are not available

Tommaso Teofili87d8b5450a6d
diff --git a/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java b/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java
index 8bb0b1dcdc2..7ab674eafdd 100644
--- a/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java
+++ b/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java
@@ -94,7 +94,8 @@ public class DatasetSplitter {
}
}
if (classValues == null) {
- throw new IllegalStateException("field \"" + classFieldName + "\" must have sorted (set) doc values");
+ // approximate with no. of terms
+ noOfClasses += leave.reader().terms(classFieldName).size();
}
noOfClasses += valueCount;
}