private void convert(int slot) {
    readerGen[slot] = currentReaderGen;
    int index = 0;
    BytesRef value = values[slot];
    if (value == null) {
      // should already be done
      assert ords[slot] == NULL_ORD;
      return;
    }

    if (sortPos == 0 && bottomSlot != -1 && bottomSlot != slot) {
      // Since we are the primary sort, the entries in the
      // queue are bounded by bottomOrd:
      assert bottomOrd < termsIndex.numOrd();
      if (reversed) {
        index = binarySearch(tempBR, termsIndex, value, bottomOrd, termsIndex.numOrd() - 1);
      } else {
        index = binarySearch(tempBR, termsIndex, value, 0, bottomOrd);
      }
    } else {
      // Full binary search
      index = binarySearch(tempBR, termsIndex, value);
    }

    if (index < 0) {
      index = -index - 2;
    }
    ords[slot] = index;
  }
 @Override
 public void setNextReader(IndexReader reader, int docBase) throws IOException {
   termsIndex = FieldCache.DEFAULT.getTermsIndex(reader, field);
   currentReaderGen++;
   assert termsIndex.numOrd() > 0;
   if (bottomSlot != -1) {
     convert(bottomSlot);
     bottomOrd = ords[bottomSlot];
   }
 }