private int compareIndexEntry(IndexEntry indexEntry, long target, IndexSearchType searchEntity) {
        int result;
        switch (searchEntity) {
            case KEY:
                result = Long.compare(indexEntry.indexKey(), target);
                break;
            case VALUE:
                result = Long.compare(indexEntry.indexValue(), target);
                break;
            default:
                throw new IllegalStateException("Unexpected IndexSearchType: " + searchEntity);
        }
        return result;
    }
Lookup lower or upper bounds for the given target.
storage/src/main/java/org/apache/kafka/storage/internals/log/AbstractIndex.java