public DocComparator getComparator(final IndexReader reader, int docbase)
throws IOException {
if (!(reader instanceof BoboIndexReader))
throw new IllegalStateException("reader must be instance of "+BoboIndexReader.class);
final FacetDataCache dataCache = _facetHandler.getFacetData((BoboIndexReader)reader);
return new DocComparator(){
@Override
public int compare(ScoreDoc doc1, ScoreDoc doc2) {
int encoded1=dataCache.orderArray.get(doc1.doc);
int encoded2=dataCache.orderArray.get(doc2.doc);
return encoded1-encoded2;