summaryrefslogtreecommitdiffstats
path: root/vespaclient-java
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahooinc.com>2022-02-15 14:17:12 +0000
committerArne H Juul <arnej@yahooinc.com>2022-02-15 15:05:36 +0000
commitf83e44760a72cc7d0226352b1114ffc3a8f97dee (patch)
treee0ed02df063aaaa0f3adab688b43018b774ce0c7 /vespaclient-java
parentd29d335828d98e248f1cb593882d2d4f08fe702c (diff)
add special DocumentOnly fieldset in Java as well
* should have same behavior in Java and C++ * extend unit tests to verify * note various places where we want to change the default on Vespa 8 branch
Diffstat (limited to 'vespaclient-java')
-rw-r--r--vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java7
-rw-r--r--vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java2
2 files changed, 7 insertions, 2 deletions
diff --git a/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java b/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java
index 0eef559da3f..da9f48f44b1 100644
--- a/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java
+++ b/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java
@@ -2,6 +2,7 @@
package com.yahoo.vespaget;
import com.yahoo.document.fieldset.AllFields;
+import com.yahoo.document.fieldset.DocumentOnly;
import com.yahoo.document.fieldset.DocIdOnly;
import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol;
import org.apache.commons.cli.CommandLine;
@@ -67,6 +68,7 @@ public class CommandLineOptions {
.longOpt(PRINTIDS_OPTION)
.build());
+ // TODO Vespa 8: change to DocumentOnly.NAME
options.addOption(Option.builder("f")
.hasArg(true)
.desc("Retrieve the specified fields only (see https://docs.vespa.ai/en/documents.html#fieldsets) (default '" + AllFields.NAME + "')")
@@ -181,8 +183,9 @@ public class CommandLineOptions {
if (printIdsOnly) {
fieldSet = DocIdOnly.NAME;
- } else if (fieldSet.isEmpty()) {
- fieldSet = AllFields.NAME;
+ } else if (fieldSet.isEmpty()) {
+ // TODO Vespa 8: change to DocumentOnly.NAME
+ fieldSet = AllFields.NAME;
}
if (!cluster.isEmpty() && !route.isEmpty()) {
diff --git a/vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java b/vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java
index 6af2344e36e..b634e899b74 100644
--- a/vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java
+++ b/vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java
@@ -2,6 +2,7 @@
package com.yahoo.vespaget;
import com.yahoo.document.fieldset.AllFields;
+import com.yahoo.document.fieldset.DocumentOnly;
import com.yahoo.document.fieldset.DocIdOnly;
import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol;
import org.junit.Rule;
@@ -55,6 +56,7 @@ public class CommandLineOptionsTest {
assertFalse(params.help);
assertFalse(params.documentIds.hasNext());
assertFalse(params.printIdsOnly);
+ // TODO Vespa 8: change to DocumentOnly.NAME
assertEquals(AllFields.NAME, params.fieldSet);
assertEquals("default-get", params.route);
assertTrue(params.cluster.isEmpty());