summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2020-11-05 20:33:08 +0100
committerJon Marius Venstad <venstad@gmail.com>2020-11-05 20:33:08 +0100
commit6ad9ce9460a3d8a3743234960164a14dfa952151 (patch)
tree771e460559df5ca431ee3852e1f8cec45a6a1b92 /document
parent392f878cdd4e636b8b20d3188dd20ba16bc3393e (diff)
Use fieldSet :[document]
Diffstat (limited to 'document')
-rw-r--r--document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java b/document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java
index 285c78ef0ab..905376e81ca 100644
--- a/document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java
+++ b/document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java
@@ -34,21 +34,24 @@ public class FieldSetRepo {
FieldSet parseFieldCollection(DocumentTypeManager docMan, String docType, String fieldNames) {
DocumentType type = docMan.getDocumentType(docType);
if (type == null) {
- throw new IllegalArgumentException("Unknown document type " + docType);
+ throw new IllegalArgumentException("Unknown document type " + docType);
}
- StringTokenizer tokenizer = new StringTokenizer(fieldNames, ",");
FieldCollection collection = new FieldCollection(type);
-
- while (tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken();
- Field f = type.getField(token);
- if (f == null) {
- throw new IllegalArgumentException("No such field " + token);
+ if (fieldNames.equals("[document]")) {
+ collection.addAll(type.fieldSet());
+ }
+ else {
+ StringTokenizer tokenizer = new StringTokenizer(fieldNames, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String token = tokenizer.nextToken();
+ Field f = type.getField(token);
+ if (f == null) {
+ throw new IllegalArgumentException("No such field " + token);
+ }
+ collection.add(f);
}
- collection.add(f);
}
-
return collection;
}