code: public static <O> KNNQuery<O> getKNNQuery(Database database, DistanceFunction<? super O> distanceFunction, Object... hints) {
      final Relation<O> relation = database.getRelation(distanceFunction.getInputTypeRestriction(), hints);
      final DistanceQuery<O> distanceQuery = relation.getDistanceQuery(distanceFunction, hints);
      return relation.getKNNQuery(distanceQuery, hints);
    }
docs: Get a KNN query object for the given distance function.
  
  An index is used when possible, but it may fall back to a linear scan.
  
  Hints include:
  <ul>
  <li>Integer: maximum value for k needed</li>
  <li>{@link de.lmu.ifi.dbs.elki.database.query.DatabaseQuery#HINT_BULK} bulk
  query needed</li>
  </ul>
  
  @param <O> Object type
  @param database Database
  @param distanceFunction Distance function
  @param hints Optimizer hints
  @return KNN Query object