Propagate tracelevel down.
@@ -1026,13 +1026,17 @@ public class Query extends com.yahoo.processing.Request implements Cloneable {
// TODO: Push down
mapCount += ranking.getProperties().encode(buffer, encodeQueryData);
- if (encodeQueryData) mapCount += ranking.getFeatures().encode(buffer);
+ if (encodeQueryData) {
+ mapCount += ranking.getFeatures().encode(buffer);
// TODO: Push down
- if (encodeQueryData && presentation.getHighlight() != null) mapCount += MapEncoder.encodeStringMultiMap(Highlight.HIGHLIGHTTERMS, presentation.getHighlight().getHighlightTerms(), buffer);
+ if (presentation.getHighlight() != null) {
+ mapCount += MapEncoder.encodeStringMultiMap(Highlight.HIGHLIGHTTERMS, presentation.getHighlight().getHighlightTerms(), buffer);
+ }
// TODO: Push down
- if (encodeQueryData) mapCount += MapEncoder.encodeSingleValue("model", "searchpath", model.getSearchPath(), buffer);
+ mapCount += MapEncoder.encodeMap("model", createModelMap(), buffer);
+ }
mapCount += MapEncoder.encodeSingleValue(DocumentDatabase.MATCH_PROPERTY, DocumentDatabase.SEARCH_DOC_TYPE_KEY, model.getDocumentDb(), buffer);
mapCount += MapEncoder.encodeMap("caches", createCacheSettingMap(), buffer);
@@ -1056,6 +1060,13 @@ public class Query extends com.yahoo.processing.Request implements Cloneable {
return Collections.<String,Boolean>emptyMap();
}
+ private Map<String, String> createModelMap() {
+ Map<String, String> m = new HashMap<>();
+ if (model.getSearchPath() != null) m.put("searchpath", model.getSearchPath());
+ if (getTraceLevel() > 0) m.put("tracelevel", String.valueOf(getTraceLevel()));
+ return m;
+ }
+
/**
* Prepares this for binary serialization.
* <p>
