aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-10-31 23:02:45 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2018-10-31 23:02:45 +0100
commitfb6f2c5f01f615b16860b76ba7a39b5fa7d5518f (patch)
tree954fdf6ef08d341df4558273b9aa26a33af7fc63 /config-model
parent3db4288215479f38f7db9c1ddeeceb69a8ff93e5 (diff)
Deprecating a whole lot of body/header related methods that should have been done a long time ago.
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java9
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java1
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java1
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableImportedSDField.java5
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableSDField.java3
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java7
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/BodyOperation.java14
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/HeaderOperation.java14
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java1
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java3
-rw-r--r--config-model/src/main/javacc/SDParser.jj3
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java7
12 files changed, 22 insertions, 46 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java
index b4d72f3a456..6387cfbdc85 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java
@@ -302,11 +302,11 @@ public class DocumentModelBuilder {
private static StructDataType handleStruct(NewDocumentType dt, SDDocumentType type) {
StructDataType s = new StructDataType(type.getName());
- for (Field f : type.getDocumentType().getHeaderType().getFieldsThisTypeOnly()) {
+ for (Field f : type.getDocumentType().getContentType().getFieldsThisTypeOnly()) {
specialHandleAnnotationReference(dt, f);
s.addField(f);
}
- for (StructDataType inherited : type.getDocumentType().getHeaderType().getInheritedTypes()) {
+ for (StructDataType inherited : type.getDocumentType().getContentType().getInheritedTypes()) {
s.inherit(inherited);
}
extractNestedTypes(dt, s);
@@ -330,11 +330,12 @@ public class DocumentModelBuilder {
}
return false;
}
+ @SuppressWarnings("deprecation")
private NewDocumentType convert(SDDocumentType sdoc) {
Map<AnnotationType, String> annotationInheritance = new HashMap<>();
Map<StructDataType, String> structInheritance = new HashMap<>();
NewDocumentType dt = new NewDocumentType(new NewDocumentType.Name(sdoc.getName()),
- sdoc.getDocumentType().getHeaderType(),
+ sdoc.getDocumentType().getContentType(),
sdoc.getDocumentType().getBodyType(),
sdoc.getFieldSets(),
convertDocumentReferencesToNames(sdoc.getDocumentReferences()));
@@ -386,7 +387,7 @@ public class DocumentModelBuilder {
e.getKey().inherit(s);
}
}
- handleStruct(dt, sdoc.getDocumentType().getHeaderType());
+ handleStruct(dt, sdoc.getDocumentType().getContentType());
handleStruct(dt, sdoc.getDocumentType().getBodyType());
extractDataTypesFromFields(dt, sdoc.fieldSet());
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java b/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java
index 04b0fc6e331..9ff749a994c 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java
@@ -25,6 +25,7 @@ public class FieldOperationApplierForStructs extends FieldOperationApplier {
}
}
+ @SuppressWarnings("deprecation")
private void copyFields(SDDocumentType structType, SDDocumentType sdoc) {
//find all fields in OTHER types that have this type:
List<SDDocumentType> list = new ArrayList<>();
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java
index 4566d188c45..39d51414607 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java
@@ -133,6 +133,7 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer {
}
}
+ @SuppressWarnings("deprecation")
static List<Field> flattenField(Field field) {
DataType fieldType = field.getDataType();
if (fieldType.getPrimitiveType() != null){
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableImportedSDField.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableImportedSDField.java
index dc2a1a2bbae..e1253d14747 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableImportedSDField.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableImportedSDField.java
@@ -58,11 +58,6 @@ public class ImmutableImportedSDField implements ImmutableSDField {
}
@Override
- public boolean isHeader() {
- return importedField.targetField().isHeader();
- }
-
- @Override
public boolean isImportedField() {
return true;
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableSDField.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableSDField.java
index 4ae7561a7bc..21ef60cf0b9 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableSDField.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/ImmutableSDField.java
@@ -10,7 +10,6 @@ import com.yahoo.vespa.indexinglanguage.expressions.Expression;
import com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -32,8 +31,6 @@ public interface ImmutableSDField {
boolean isExtraField();
- boolean isHeader();
-
boolean isImportedField();
/**
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java
index 98be4900ef6..0e9e09844d1 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java
@@ -148,9 +148,10 @@ public class SDDocumentType implements Cloneable, Serializable {
* @param name The name of the new document type
* @param search check for type ID collisions in this search definition
*/
+ @SuppressWarnings("deprecation")
public SDDocumentType(String name, Search search) {
docType = new DocumentType(name);
- docType.getHeaderType().setCompressionConfig(new CompressionConfig());
+ docType.getContentType().setCompressionConfig(new CompressionConfig());
docType.getBodyType().setCompressionConfig(new CompressionConfig());
validateId(search);
inherit(VESPA_DOCUMENT);
@@ -163,8 +164,8 @@ public class SDDocumentType implements Cloneable, Serializable {
this.structType = structType;
inheritedTypes.clear();
} else {
- if (docType.getHeaderType() != null) {
- this.structType = docType.getHeaderType();
+ if (docType.getContentType() != null) {
+ this.structType = docType.getContentType();
inheritedTypes.clear();
} else {
throw new IllegalArgumentException("You can not set a null struct");
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/BodyOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/BodyOperation.java
deleted file mode 100644
index 7ea11873a12..00000000000
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/BodyOperation.java
+++ /dev/null
@@ -1,14 +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.searchdefinition.fieldoperation;
-
-import com.yahoo.searchdefinition.document.SDField;
-
-/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
- */
-public class BodyOperation implements FieldOperation {
- public void apply(SDField field) {
- field.setHeader(false);
- field.setHeaderOrBodyDefined(true);
- }
-}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/HeaderOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/HeaderOperation.java
deleted file mode 100644
index 22d85f89105..00000000000
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/HeaderOperation.java
+++ /dev/null
@@ -1,14 +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.searchdefinition.fieldoperation;
-
-import com.yahoo.searchdefinition.document.SDField;
-
-/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
- */
-public class HeaderOperation implements FieldOperation {
- public void apply(SDField field) {
- field.setHeader(true);
- field.setHeaderOrBodyDefined(true);
- }
-}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java
index 803a6c5ab40..b62639961bf 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java
@@ -56,6 +56,7 @@ public class AddExtraFieldsToDocument extends Processor {
addField(search, document, field, validate);
}
+ @SuppressWarnings("deprecation")
private void addSummaryField(Search search, SDDocumentType document, SummaryField field, boolean validate) {
Field docField = document.getField(field.getName());
if (docField == null) {
diff --git a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java
index 9368d6aaa39..9e07171c183 100644
--- a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java
+++ b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java
@@ -70,6 +70,7 @@ public class DocumentManager {
}
}
+ @SuppressWarnings("deprecation")
private void buildConfig(DataType type, Datatype.Builder builder) {
builder.id(type.getId());
if (type instanceof ArrayDataType) {
@@ -92,7 +93,7 @@ public class DocumentManager {
builder.documenttype(doc);
doc.
name(dt.getName()).
- headerstruct(dt.getHeaderType().getId()).
+ headerstruct(dt.getContentType().getId()).
bodystruct(dt.getBodyType().getId());
for (DocumentType inherited : dt.getInheritedTypes()) {
doc.inherits(new Datatype.Documenttype.Inherits.Builder().name(inherited.getName()));
diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj
index d1c67a6d425..20a0e04b15a 100644
--- a/config-model/src/main/javacc/SDParser.jj
+++ b/config-model/src/main/javacc/SDParser.jj
@@ -70,6 +70,7 @@ import org.apache.commons.lang.StringUtils;
*
* @author bratseth
*/
+ @SuppressWarnings("deprecation")
public class SDParser {
private DocumentTypeManager docMan = null;
@@ -579,7 +580,7 @@ void compression(SDDocumentType document, String name) :
<COMPRESSION> lbrace() (cfg = compressionItem(cfg) (<NL>)*)* <RBRACE>
{
if (name == null || name.equals("header")) {
- document.getDocumentType().getHeaderType().setCompressionConfig(cfg);
+ document.getDocumentType().getContentType().setCompressionConfig(cfg);
}
if (name == null || name.equals("body")) {
document.getDocumentType().getBodyType().setCompressionConfig(cfg);
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java
index 127ed7a528b..0c464d668f7 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java
@@ -19,7 +19,11 @@ import org.junit.Test;
import java.io.IOException;
import java.util.Iterator;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* Tests importing of search definitions
@@ -29,6 +33,7 @@ import static org.junit.Assert.*;
public class SearchImporterTestCase extends SearchDefinitionTestCase {
@Test
+ @SuppressWarnings("deprecation")
public void testSimpleImporting() throws IOException, ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
SearchBuilder sb = new SearchBuilder(rankProfileRegistry, new QueryProfileRegistry());