summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-06-16 19:05:53 +0200
committerGitHub <noreply@github.com>2022-06-16 19:05:53 +0200
commit635dd639aae6386ac8977ede9557210534934bd0 (patch)
tree3e4bcf063c4875dc56aa1ca24dabed32b5e6fe79
parent1a79c78e274fb587634f48f4a131a3cbc97192ff (diff)
parentd21f4042eb053fb63cc61747efe8a1953144fe28 (diff)
Merge pull request #23128 from vespa-engine/bratseth/default-short-form-harder
Default to tensor short form more places
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java6
-rw-r--r--document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java2
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java4
4 files changed, 8 insertions, 6 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
index f6e158cf04a..160a039fe2d 100644
--- a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
+++ b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
@@ -300,7 +300,7 @@ public class QueryProperties extends Properties {
}
else if (key.size() == 3 && key.get(1).equals(Presentation.FORMAT)) {
if (key.last().equals(Presentation.TENSORS))
- query.getPresentation().setTensorShortForm(asString(value, ""));
+ query.getPresentation().setTensorShortForm(asString(value, "short"));
else
throwIllegalParameter(key.last(), Presentation.FORMAT);
}
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 58353cc5907..4f55b9946a8 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
@@ -124,13 +124,14 @@ public class JsonRenderer extends AsynchronousSectionedRenderer<Result> {
private volatile JsonGenerator generator;
private volatile FieldConsumer fieldConsumer;
private volatile Deque<Integer> renderedChildren;
+
static class FieldConsumerSettings {
volatile boolean debugRendering = false;
volatile boolean jsonDeepMaps = true;
volatile boolean jsonWsets = true;
volatile boolean jsonMapsAll = true;
volatile boolean jsonWsetsAll = false;
- volatile boolean tensorShortForm = false;
+ volatile boolean tensorShortForm = true;
boolean convertDeep() { return (jsonDeepMaps || jsonWsets); }
void init() {
this.debugRendering = false;
@@ -138,7 +139,7 @@ public class JsonRenderer extends AsynchronousSectionedRenderer<Result> {
this.jsonWsets = true;
this.jsonMapsAll = true;
this.jsonWsetsAll = true;
- this.tensorShortForm = false;
+ this.tensorShortForm = true;
}
void getSettings(Query q) {
if (q == null) {
@@ -155,6 +156,7 @@ public class JsonRenderer extends AsynchronousSectionedRenderer<Result> {
this.tensorShortForm = q.getPresentation().getTensorShortForm();
}
}
+
private volatile FieldConsumerSettings fieldConsumerSettings;
private volatile LongSupplier timeSource;
private volatile OutputStream stream;
diff --git a/document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java b/document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java
index ab4af5e722e..675ad502630 100644
--- a/document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java
+++ b/document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java
@@ -1757,7 +1757,7 @@ public class JsonReaderTestCase {
@Test
public void tensor_add_update_on_not_fully_specified_cell_throws() {
- illegalTensorAddUpdate("Error in 'sparse_tensor': Missing a label for dimension y for tensor(x{},y{})",
+ illegalTensorAddUpdate("Error in 'sparse_tensor': Missing a label for dimension 'y' for tensor(x{},y{})",
"sparse_tensor",
"{",
" 'cells': [",
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java b/vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java
index 92bdfb2b3a4..342aca5fb3d 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java
@@ -225,8 +225,8 @@ public abstract class TensorAddress implements Comparable<TensorAddress> {
void validate() {
for (int i = 0; i < labels.length; i++)
if (labels[i] == null)
- throw new IllegalArgumentException("Missing a label for dimension " +
- type.dimensions().get(i).name() + " for " + type);
+ throw new IllegalArgumentException("Missing a label for dimension '" +
+ type.dimensions().get(i).name() + "' for " + type);
}
public TensorAddress build() {