if (allTerms) {
try {
for (int i = 0; i < fieldsNames.length; i++) {
for (IndexReader reader : context.searcher().subReaders()) {
FieldData fieldData = fieldDataCache.cache(fieldsDataType[i], reader, indexFieldsNames[i]);
fieldData.forEachValue(aggregator);
}
}
} catch (Exception e) {
throw new FacetPhaseExecutionException(facetName, "failed to load all terms", e);
}