diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-02-07 14:36:41 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-02-07 14:36:41 +0100 |
commit | 70227078bed8a4eed2a297af84b10783456e84a7 (patch) | |
tree | 68efb6a7614775d8d1a56806e50080952059762c /container-search/src/main/java/com/yahoo/search/rendering | |
parent | 54e4df56234906450f2d6bf82a0527e924e987f7 (diff) |
Wire in property presentation.format.tensors with alias format.tensors
- Move presentation.format.tensors from JsonRenderer to Presentation
- Add aliases recursively
- Allow compound aliases
- Allow a query profile type to describe its own value
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/rendering')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java b/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java index f9a91558254..8e8e687076f 100644 --- a/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java +++ b/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java @@ -79,7 +79,6 @@ public class JsonRenderer extends AsynchronousSectionedRenderer<Result> { private static final CompoundName WRAP_ALL_MAPS = new CompoundName("renderer.json.jsonMaps"); private static final CompoundName DEBUG_RENDERING_KEY = new CompoundName("renderer.json.debug"); private static final CompoundName JSON_CALLBACK = new CompoundName("jsoncallback"); - private static final CompoundName TENSOR_FORMAT = new CompoundName("format.tensors"); // if this must be optimized, simply use com.fasterxml.jackson.core.SerializableString private static final String BUCKET_LIMITS = "limits"; @@ -173,7 +172,8 @@ public class JsonRenderer extends AsynchronousSectionedRenderer<Result> { beginJsonCallback(stream); debugRendering = getDebugRendering(getResult().getQuery()); jsonMaps = getWrapAllMaps(getResult().getQuery()); - tensorShortFormRendering = getTensorShortFormRendering(getResult().getQuery()); + tensorShortFormRendering = getResult().getQuery() != null + && getResult().getQuery().getPresentation().getTensorShortForm(); setGenerator(generatorFactory.createGenerator(stream, JsonEncoding.UTF8), debugRendering); renderedChildren = new ArrayDeque<>(); generator.writeStartObject(); @@ -212,12 +212,6 @@ public class JsonRenderer extends AsynchronousSectionedRenderer<Result> { return q != null && q.properties().getBoolean(DEBUG_RENDERING_KEY, false); } - private boolean getTensorShortFormRendering(Query q) { - if (q == null || q.properties().get(TENSOR_FORMAT) == null) - return false; - return q.properties().getString(TENSOR_FORMAT).equalsIgnoreCase("short"); - } - protected void renderTrace(Trace trace) throws IOException { if (!trace.traceNode().children().iterator().hasNext()) return; if (getResult().getQuery().getTraceLevel() == 0) return; |