private Item buildNearestNeighbor(String key, Inspector value) {
        HashMap<Integer, Inspector> children = childMap(value);
        Preconditions.checkArgument(children.size() == 2, "Expected 2 arguments, got %s.", children.size());
        String field = children.get(0).asString();
        String property = children.get(1).asString();
        NearestNeighborItem item = new NearestNeighborItem(indexFactsSession.getCanonicName(field), property);
        Inspector annotations = getAnnotations(value);
        if (annotations != null){
            annotations.traverse((ObjectTraverser) (annotation_name, annotation_value) -> {
                if (TARGET_HITS.equals(annotation_name)){
                    item.setTargetNumHits((int)(annotation_value.asDouble()));
                }
                if (TARGET_NUM_HITS.equals(annotation_name)){
                    item.setTargetNumHits((int)(annotation_value.asDouble()));
                }
                if (DISTANCE_THRESHOLD.equals(annotation_name)) {
                    double distanceThreshold = annotation_value.asDouble();
                    item.setDistanceThreshold(distanceThreshold);
                }
                if (HNSW_EXPLORE_ADDITIONAL_HITS.equals(annotation_name)) {
                    int hnswExploreAdditionalHits = (int)(annotation_value.asDouble());
                    item.setHnswExploreAdditionalHits(hnswExploreAdditionalHits);                    
                }
                if (APPROXIMATE.equals(annotation_name)) {
                    boolean allowApproximate = annotation_value.asBool();
                    item.setAllowApproximate(allowApproximate);
                }
                if (LABEL.equals(annotation_name)) {
                    item.setLabel(annotation_value.asString());
                }
            });
        }
        return item;
    }
Translates a list of grouping requests on JSON form to a list in the grouping language form
container-search/src/main/java/com/yahoo/search/query/SelectParser.java