code: private void search(Node node, E q, int k, List<Neighbor<E, E>> neighbors) {
          int d = (int) distance.d(node.object, q);
  
          if (d <= k) {
              if (node.object != q || !identicalExcluded) {
                  neighbors.add(new Neighbor<>(node.object, node.object, node.index, d));
              }
          }
  
          if (node.children != null) {
              int start = Math.max(1, d-k);
              int end = Math.min(node.children.size(), d+k+1);
              for (int i = start; i < end; i++) {
                  Node child = node.children.get(i);
                  if (child != null) {
                      search(child, q, k, neighbors);
                  }
              }
          }
      }
docs: Do a range search in the given subtree.
  @param node the root of subtree.
  @param q the query object.
  @param k the range of query.
  @param neighbors the returned results of which d(x, target) &le; k.