Skip to content

Commit

Permalink
Getter should reflect Setter
Browse files Browse the repository at this point in the history
  • Loading branch information
arnej27959 committed Jan 31, 2025
1 parent ab4a2e0 commit 65c356f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions container-search/abi-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -5444,6 +5444,7 @@
"public void setSummaryFields(java.lang.String)",
"public boolean getTensorShortForm()",
"public boolean getTensorHexDense()",
"public java.lang.String getTensorFormat()",
"public void setTensorShortForm(java.lang.String)",
"public void setTensorFormat(java.lang.String)",
"public void setTensorShortForm(boolean)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ public class Presentation implements Cloneable {
/** Whether optional timing data should be rendered */
private boolean timing = false;

/** Whether to dense (part of ) tensors in hex string form */
private boolean tensorHexDense = false;

/** Whether to renders tensors in short form */
private boolean tensorShortForm = true;

/** Whether to renders tensors in short form */
private boolean tensorDirectValues = false; // TODO: Flip default on Vespa 9

/** Whether to dense (part of) tensors in hex string form */
private boolean tensorHexDense = false;

/** Set of explicitly requested summary fields, instead of summary classes */
private Set<String> summaryFields = LazySet.newHashSet();

Expand Down Expand Up @@ -192,6 +192,17 @@ public void setSummaryFields(String asString) {
/** whether dense part of tensors should be represented as a string of hex digits */
public boolean getTensorHexDense() { return tensorHexDense; }

/** the current tensor format, see setTensorFormat() */
public String getTensorFormat() {
String format = "long";
if (tensorShortForm) format = "short";
if (tensorHexDense) format = "hex";
if (tensorDirectValues) {
return (format + "-value");
}
return format;
}

/** @deprecated use setTensorFormat(). */
@Deprecated // TODO: Remove on Vespa 9
public void setTensorShortForm(String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private static Map<CompoundName, GetterSetter> createPropertySetterMap() {
map.put(CompoundName.fromComponents(Presentation.PRESENTATION, Presentation.FORMAT), GetterSetter.of(query -> query.getPresentation().getFormat(), (query, value) -> query.getPresentation().setFormat(asString(value, ""))));
map.put(CompoundName.fromComponents(Presentation.PRESENTATION, Presentation.TIMING), GetterSetter.of(query -> query.getPresentation().getTiming(), (query, value) -> query.getPresentation().setTiming(asBoolean(value, true))));
map.put(CompoundName.fromComponents(Presentation.PRESENTATION, Presentation.SUMMARY_FIELDS), GetterSetter.of(query -> query.getPresentation().getSummaryFields(), (query, value) -> query.getPresentation().setSummaryFields(asString(value, ""))));
map.put(CompoundName.fromComponents(Presentation.PRESENTATION, Presentation.FORMAT, Presentation.TENSORS), GetterSetter.of(query -> query.getPresentation().getTensorShortForm(), (query, value) -> query.getPresentation().setTensorFormat(asString(value, "short")))); // TODO: Switch default to short-value on Vespa 9);
map.put(CompoundName.fromComponents(Presentation.PRESENTATION, Presentation.FORMAT, Presentation.TENSORS), GetterSetter.of(query -> query.getPresentation().getTensorFormat(), (query, value) -> query.getPresentation().setTensorFormat(asString(value, "short")))); // TODO: Switch default to short-value on Vespa 9);
map.put(Query.HITS, GetterSetter.of(Query::getHits, (query, value) -> query.setHits(asInteger(value,10))));
map.put(Query.OFFSET, GetterSetter.of(Query::getOffset, (query, value) -> query.setOffset(asInteger(value,0))));
map.put(Query.TIMEOUT, GetterSetter.of(Query::getTimeout, (query, value) -> query.setTimeout(value.toString())));
Expand Down

0 comments on commit 65c356f

Please sign in to comment.