public int compareBottom(int doc) {
    assert bottomSlot != -1;
    int order = termsIndex.getOrd(doc);
    int ord = (order == 0) ? NULL_ORD : order;
    final int cmp = bottomOrd - ord;
    if (cmp != 0) {
      return cmp;
    }

    // take care of the case where both vals are null
    if (bottomOrd == NULL_ORD) return 0;
    return bottomValue.compareTo(termsIndex.lookup(order, tempBR));
  }
 @Override
 public void copy(int slot, int doc) {
   final int ord = termsIndex.getOrd(doc);
   assert ord >= 0;
   if (ord == 0) {
     ords[slot] = NULL_ORD;
     values[slot] = null;
   } else {
     ords[slot] = ord;
     if (values[slot] == null) {
       values[slot] = new BytesRef();
     }
     termsIndex.lookup(ord, values[slot]);
   }
   readerGen[slot] = currentReaderGen;
 }