[New] GenericReport now adheres to facet value limit if trimFaceValues=true on report
This commit is contained in:
parent
b03a8781fa
commit
e31e606754
|
@ -20,6 +20,7 @@ public class ReportConstants {
|
||||||
public static final String PARAM_FIELD_REF2 = "fieldRef2";
|
public static final String PARAM_FIELD_REF2 = "fieldRef2";
|
||||||
public static final String PARAM_ALLOW_MISSING_COLUMNS = "allowMissingColumns";
|
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_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_POLICY = "policy";
|
||||||
|
|
||||||
public static final String PARAM_JOIN_PARAM = "joinParam";
|
public static final String PARAM_JOIN_PARAM = "joinParam";
|
||||||
|
|
|
@ -540,7 +540,7 @@ public class GenericReport extends ReportPolicy {
|
||||||
.sorted(comparing(StringParameter::getIndex)) //
|
.sorted(comparing(StringParameter::getIndex)) //
|
||||||
.map(StringParameter::getUom).collect(toList());
|
.map(StringParameter::getUom).collect(toList());
|
||||||
|
|
||||||
int count = 0;
|
boolean trimFacetValues = this.reportRes.getBoolean(PARAM_TRIM_FACETS_VALUES);
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Map<String, StrolchRootElement> row = iter.next();
|
Map<String, StrolchRootElement> row = iter.next();
|
||||||
|
|
||||||
|
@ -553,9 +553,8 @@ public class GenericReport extends ReportPolicy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop if we have enough data, or iterated over "enough"
|
// stop if we have enough data
|
||||||
count++;
|
if (trimFacetValues && result.stream().mapToInt(e -> e.getValue().size()).allMatch(v -> v >= limit))
|
||||||
if (count > 1000 || result.size() > limit * result.keySet().size())
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue