docs: @SuppressWarnings("unchecked")
    public static <O> KNNQuery<O> getLinearScanKNNQuery(DistanceQuery<O> distanceQuery) {
      // Slight optimizations of linear scans
      if(distanceQuery instanceof PrimitiveDistanceQuery) {
        final PrimitiveDistanceQuery<O> pdq = (PrimitiveDistanceQuery<O>) distanceQuery;
        if(EuclideanDistanceFunction.STATIC.equals(pdq.getDistanceFunction())) {
          final PrimitiveDistanceQuery<NumberVector> ndq = (PrimitiveDistanceQuery<NumberVector>) pdq;
          return (KNNQuery<O>) new LinearScanEuclideanDistanceKNNQuery<>(ndq);
        }
        return new LinearScanPrimitiveDistanceKNNQuery<>(pdq);
      }
      return new LinearScanDistanceKNNQuery<>(distanceQuery);
    }