NavigableSet<IndexValue> find(StoreKey keyToFind) throws StoreException {
      NavigableSet<IndexValue> toReturn = null;
      if (bloomFilter != null) {
        metrics.bloomAccessedCount.inc();
      }
      if (bloomFilter == null || bloomFilter.isPresent(getStoreKeyBytes(keyToFind))) {
        if (bloomFilter == null) {
          logger.trace("IndexSegment {} bloom filter empty. Searching file with start offset {} and for key {}",
              indexFile.getAbsolutePath(), startOffset, keyToFind);
        } else {
          metrics.bloomPositiveCount.inc();
          logger.trace("IndexSegment {} found in bloom filter for index with start offset {} and for key {} ",
              indexFile.getAbsolutePath(), startOffset, keyToFind);
        }
        if (config.storeIndexMemState == IndexMemState.MMAP_WITH_FORCE_LOAD
            || config.storeIndexMemState == IndexMemState.MMAP_WITHOUT_FORCE_LOAD) {
          // isLoaded() will be true only if the entire buffer is in memory - so it being false does not necessarily
          // mean that the pages in the scope of the search need to be loaded from disk.
          // Secondly, even if it returned true (or false), by the time the actual lookup is done,
          // the situation may be different.
          if (((MappedByteBuffer) serEntries).isLoaded()) {
            metrics.mappedSegmentIsLoadedDuringFindCount.inc();
          } else {
            metrics.mappedSegmentIsNotLoadedDuringFindCount.inc();
          }
        }
        // binary search on the mapped file
        ByteBuffer duplicate = serEntries.duplicate();
        int low = 0;
        int totalEntries = numberOfEntries(duplicate);
        int high = totalEntries - 1;
        logger.trace("binary search low : {} high : {}", low, high);
        while (low <= high) {
          int mid = (int) (Math.ceil(high / 2.0 + low / 2.0));
          StoreKey found = getKeyAt(duplicate, mid);
          logger.trace("Index Segment {} binary search - key found on iteration {}", indexFile.getAbsolutePath(),
              found);
          int result = found.compareTo(keyToFind);
          if (result == 0) {
            toReturn = new TreeSet<>();
            getAllValuesFromMmap(duplicate, keyToFind, mid, totalEntries, toReturn);
            break;
          } else if (result < 0) {
            low = mid + 1;
          } else {
            high = mid - 1;
          }
        }
        if (bloomFilter != null && toReturn == null) {
          metrics.bloomFalsePositiveCount.inc();
        }
      }
      return toReturn;
    }
Finds an entry given a key. Does a binary search on the mapped persistent segment
@param keyToFind The key to find
@return The blob index value that represents the key or null if not found
@throws StoreException
ambry-store/src/main/java/com/github/ambry/store/IndexSegment.java