diff --git a/li.strolch.service/src/main/java/li/strolch/report/ReportConstants.java b/li.strolch.service/src/main/java/li/strolch/report/ReportConstants.java index 948eeb159..a665067f7 100644 --- a/li.strolch.service/src/main/java/li/strolch/report/ReportConstants.java +++ b/li.strolch.service/src/main/java/li/strolch/report/ReportConstants.java @@ -20,6 +20,7 @@ public class ReportConstants { public static final String PARAM_FIELD_REF2 = "fieldRef2"; public static final String PARAM_ALLOW_MISSING_COLUMNS = "allowMissingColumns"; public static final String PARAM_FILTER_MISSING_VALUES_AS_TRUE = "filterMissingValuesAsTrue"; + public static final String PARAM_TRIM_FACETS_VALUES = "trimFacetValues"; public static final String PARAM_POLICY = "policy"; public static final String PARAM_JOIN_PARAM = "joinParam"; diff --git a/li.strolch.service/src/main/java/li/strolch/report/policy/GenericReport.java b/li.strolch.service/src/main/java/li/strolch/report/policy/GenericReport.java index ac52ee4ab..2d9111637 100644 --- a/li.strolch.service/src/main/java/li/strolch/report/policy/GenericReport.java +++ b/li.strolch.service/src/main/java/li/strolch/report/policy/GenericReport.java @@ -540,7 +540,7 @@ public class GenericReport extends ReportPolicy { .sorted(comparing(StringParameter::getIndex)) // .map(StringParameter::getUom).collect(toList()); - int count = 0; + boolean trimFacetValues = this.reportRes.getBoolean(PARAM_TRIM_FACETS_VALUES); while (iter.hasNext()) { Map row = iter.next(); @@ -553,9 +553,8 @@ public class GenericReport extends ReportPolicy { } } - // stop if we have enough data, or iterated over "enough" - count++; - if (count > 1000 || result.size() > limit * result.keySet().size()) + // stop if we have enough data + if (trimFacetValues && result.stream().mapToInt(e -> e.getValue().size()).allMatch(v -> v >= limit)) break; }