code: public static <O> DistanceQuery<O> getDistanceQuery(Database database, DistanceFunction<? super O> distanceFunction, Object... hints) {
      final Relation<O> objectQuery = database.getRelation(distanceFunction.getInputTypeRestriction(), hints);
      return database.getDistanceQuery(objectQuery, distanceFunction, hints);
    }
docs: Get a distance query for a given distance function, automatically choosing
  a relation.
  
  @param <O> Object type
  @param database Database
  @param distanceFunction Distance function
  @param hints Optimizer hints
  @return Distance query