@Override
        boolean serialize(StringBuilder destination, NearestNeighborItem item) {
            destination.append("{");
            int initLen = destination.length();
            destination.append(leafAnnotations(item));
            comma(destination, initLen);
            int targetNumHits = item.getTargetNumHits();
            annotationKey(destination, YqlParser.TARGET_NUM_HITS).append(targetNumHits);
            double distanceThreshold = item.getDistanceThreshold();
            if (distanceThreshold < Double.POSITIVE_INFINITY) {
                comma(destination, initLen);
                String key = YqlParser.DISTANCE_THRESHOLD;
                annotationKey(destination, key).append(distanceThreshold);
            }
            int explore = item.getHnswExploreAdditionalHits();
            if (explore != 0) {
                comma(destination, initLen);
                String key = YqlParser.HNSW_EXPLORE_ADDITIONAL_HITS;
                annotationKey(destination, key).append(explore);
            }
            boolean allow_approx = item.getAllowApproximate();
            if (! allow_approx) {
                comma(destination, initLen);
                annotationKey(destination, "approximate").append(allow_approx);
            }
            destination.append("}");
            destination.append(NEAREST_NEIGHBOR).append('(');
            destination.append(item.getIndexName()).append(", ");
            destination.append(item.getQueryTensorName()).append(')');
            return false;
        }
Serialize Vespa query trees to YQL+ strings.

@author Steinar Knutsen
container-search/src/main/java/com/yahoo/search/yql/VespaSerializer.java