@Override
    public Result search(Query query, Execution execution) {
        Result r = execution.search(query);
        String propertyName = query.properties().getString(PROPERTYNAME);
        if (propertyName != null) {
            execution.fill(r);
            for (Iterator<Hit> i = r.hits().deepIterator(); i.hasNext();) {
                Hit h = i.next();
                if (h instanceof FastHit hit) {
                    Object o = hit.getField(propertyName);
                    if (o instanceof JSONString j) {
                        r.getQuery().trace(JSON_FIELD + j.getContent(), false, 5);
                    }
                    if (o instanceof StructuredData d) {
                        r.getQuery().trace(STRUCT_FIELD + d.toJson(), false, 5);
                    }
                    if (o instanceof FeatureData d) {
                        r.getQuery().trace(FEATURE_FIELD + d.toJson(), false, 5);
                    }
                }
            }
        }
        return r;
    }
Save the query in the incoming state to a meta hit in the result.

@author Steinar Knutsen
container-search/src/main/java/com/yahoo/prelude/searcher/JSONDebugSearcher.java