diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-08-04 07:25:45 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-08-04 12:14:17 +0000 |
commit | bdc43e2dda007965b770cd0a778d6a2f2634d276 (patch) | |
tree | 990cb7bd1babbc9c3b9d77e880c290ed383afb16 /document/src/main | |
parent | bd3399a2677b32888ef2588adf1c976ed4cdb5cb (diff) |
Remove the unused [header] and [body] fieldsets to simplify backend optimization during get.
Diffstat (limited to 'document/src/main')
3 files changed, 9 insertions, 95 deletions
diff --git a/document/src/main/java/com/yahoo/document/fieldset/BodyFields.java b/document/src/main/java/com/yahoo/document/fieldset/BodyFields.java deleted file mode 100644 index 1fd0d1129fa..00000000000 --- a/document/src/main/java/com/yahoo/document/fieldset/BodyFields.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.document.fieldset; - -import com.yahoo.document.Field; - -/** - * @deprecated do not use - */ -@Deprecated // TODO: Remove on Vespa 8 -public class BodyFields implements FieldSet { - @Override - public boolean contains(FieldSet o) { - if (o instanceof BodyFields || o instanceof DocIdOnly || o instanceof NoFields) { - return true; - } - - if (o instanceof Field) { - return !((Field) o).isHeader(); - } - - if (o instanceof FieldCollection) { - FieldCollection c = (FieldCollection)o; - for (Field f : c) { - if (f.isHeader()) { - return false; - } - } - - return true; - } else { - return false; - } - } - - @Override - public FieldSet clone() throws CloneNotSupportedException { - return new BodyFields(); - } - -} 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 a7035439903..862a374f182 100644 --- a/document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java +++ b/document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java @@ -7,27 +7,27 @@ import com.yahoo.document.DocumentTypeManager; import com.yahoo.document.Field; import com.yahoo.document.datatypes.FieldValue; -import java.lang.String; -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; /** * TODO: Move to document and implement */ public class FieldSetRepo { - @SuppressWarnings("deprecation") FieldSet parseSpecialValues(String name) { if (name.equals("[id]")) { return new DocIdOnly(); } else if (name.equals("[all]")) { return (new AllFields()); } else if (name.equals("[none]")) { return (new NoFields()); } - else if (name.equals("[header]")) { return (new HeaderFields()); } else if (name.equals("[docid]")) { return (new DocIdOnly()); } - else if (name.equals("[body]")) { return (new BodyFields()); } else { throw new IllegalArgumentException( "The only special names (enclosed in '[]') allowed are " + - "id, all, none, header, body"); + "id, all, none"); } } @@ -40,7 +40,7 @@ public class FieldSetRepo { StringTokenizer tokenizer = new StringTokenizer(fieldNames, ","); FieldCollection collection = new FieldCollection(type); - for (; tokenizer.hasMoreTokens(); ) { + while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); Field f = type.getField(token); if (f == null) { @@ -74,14 +74,13 @@ public class FieldSetRepo { return parseFieldCollection(docMan, type, fields); } - @SuppressWarnings("deprecation") public String serialize(FieldSet fieldSet) { if (fieldSet instanceof Field) { return ((Field)fieldSet).getName(); } else if (fieldSet instanceof FieldCollection) { FieldCollection c = ((FieldCollection)fieldSet); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); for (Field f : c) { if (buffer.length() == 0) { buffer.append(c.getDocumentType().getName()); @@ -97,10 +96,6 @@ public class FieldSetRepo { return "[all]"; } else if (fieldSet instanceof NoFields) { return "[none]"; - } else if (fieldSet instanceof BodyFields) { - return "[body]"; - } else if (fieldSet instanceof HeaderFields) { - return "[header]"; } else if (fieldSet instanceof DocIdOnly) { return "[docid]"; } else { @@ -127,7 +122,7 @@ public class FieldSetRepo { * Strips all fields not wanted by the given field set from the document. */ public void stripFields(Document target, FieldSet fieldSet) { - List<Field> toStrip = new ArrayList<Field>(); + List<Field> toStrip = new ArrayList<>(); for (Iterator<Map.Entry<Field, FieldValue>> i = target.iterator(); i.hasNext();) { Map.Entry<Field, FieldValue> v = i.next(); diff --git a/document/src/main/java/com/yahoo/document/fieldset/HeaderFields.java b/document/src/main/java/com/yahoo/document/fieldset/HeaderFields.java deleted file mode 100644 index 220de1ab416..00000000000 --- a/document/src/main/java/com/yahoo/document/fieldset/HeaderFields.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.document.fieldset; - -import com.yahoo.document.Field; - -/** - * @deprecated do not use - */ -@Deprecated // TODO: Remove on Vespa 8 -public class HeaderFields implements FieldSet { - - @Override - public boolean contains(FieldSet o) { - if (o instanceof HeaderFields || o instanceof DocIdOnly || o instanceof NoFields) { - return true; - } - - if (o instanceof Field) { - return ((Field)o).isHeader(); - } - - if (o instanceof FieldCollection) { - FieldCollection c = (FieldCollection)o; - for (Field f : c) { - if (!f.isHeader()) { - return false; - } - } - - return true; - } else { - return false; - } - } - - @Override - public FieldSet clone() throws CloneNotSupportedException { - return new HeaderFields(); - } - -} |