si = FieldCache.DEFAULT.getStringIndex(searcher.getReader(), fieldName);
}
catch (IOException e) {
throw new RuntimeException( "failed to open field cache for: "+fieldName, e );
}
FieldFacetStats all = new FieldFacetStats( "all", si, ft, 0 );
StatsValues allstats = new StatsValues();
if ( all.nTerms <= 0 || docs.size() <= 0 ) return allstats.getStatsValues();
// don't worry about faceting if the no documents match...
int i=0;
final FieldFacetStats[] finfo = new FieldFacetStats[facet.length];
for( String f : facet ) {
ft = searcher.getSchema().getFieldType(f);
try {
si = FieldCache.DEFAULT.getStringIndex(searcher.getReader(), f);
}
catch (IOException e) {
throw new RuntimeException( "failed to open field cache for: "+f, e );
}
finfo[i++] = new FieldFacetStats( f, si, ft, 0 );
}
DocIterator iter = docs.iterator();
while (iter.hasNext()) {
int docID = iter.nextDoc();
String raw = all.getTermText(docID);
Double v = null;
if( raw != null ) {
v = Double.parseDouble( all.ft.indexedToReadable(raw) );
allstats.accumulate( v );
}