Search in sources :

Example 1 with FeatureData

use of com.yahoo.search.result.FeatureData in project vespa by vespa-engine.

the class JSONDebugSearcher method search.

public Result search(com.yahoo.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) {
                FastHit hit = (FastHit) h;
                Object o = hit.getField(propertyName);
                if (o instanceof JSONString) {
                    JSONString j = (JSONString) o;
                    r.getQuery().trace(JSON_FIELD + j.getContent(), false, 5);
                }
                if (o instanceof StructuredData) {
                    StructuredData d = (StructuredData) o;
                    r.getQuery().trace(STRUCT_FIELD + d.toJson(), false, 5);
                }
                if (o instanceof FeatureData) {
                    FeatureData d = (FeatureData) o;
                    r.getQuery().trace(FEATURE_FIELD + d.toJson(), false, 5);
                }
            }
        }
    }
    return r;
}
Also used : Hit(com.yahoo.search.result.Hit) FastHit(com.yahoo.prelude.fastsearch.FastHit) FastHit(com.yahoo.prelude.fastsearch.FastHit) StructuredData(com.yahoo.search.result.StructuredData) FeatureData(com.yahoo.search.result.FeatureData) JSONString(com.yahoo.prelude.hitfield.JSONString) JSONString(com.yahoo.prelude.hitfield.JSONString) Result(com.yahoo.search.Result)

Aggregations

FastHit (com.yahoo.prelude.fastsearch.FastHit)1 JSONString (com.yahoo.prelude.hitfield.JSONString)1 Result (com.yahoo.search.Result)1 FeatureData (com.yahoo.search.result.FeatureData)1 Hit (com.yahoo.search.result.Hit)1 StructuredData (com.yahoo.search.result.StructuredData)1