diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-03-08 11:27:42 +0000 |
---|---|---|
committer | Arne H Juul <arnej@yahooinc.com> | 2022-03-11 13:36:53 +0000 |
commit | ee4fb1f44497518575d0cd38afee55b4a20706cf (patch) | |
tree | 8af4f9454558b53452fd62a801e04c08581e7ecb /config-model/src/test/java/com/yahoo/searchdefinition/processing | |
parent | ba2758ab815ebe7ab2fa9b702b3ace7d5c0fd0d7 (diff) |
even TemporarySDField should be connected to a "repo"
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition/processing')
3 files changed, 16 insertions, 14 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/AdjustPositionSummaryFieldsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/AdjustPositionSummaryFieldsTestCase.java index 5d2590a420d..926e26451d7 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/AdjustPositionSummaryFieldsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/AdjustPositionSummaryFieldsTestCase.java @@ -186,9 +186,10 @@ public class AdjustPositionSummaryFieldsTestCase { private void createPositionField(Schema schema, boolean setupPosAttr, boolean setupBadAttr) { String ilScript = setupPosAttr ? "{ summary | attribute }" : "{ summary }"; - schema.getDocument().addField(createField("pos", PositionDataType.INSTANCE, ilScript)); + var doc = schema.getDocument(); + doc.addField(createField(doc, "pos", PositionDataType.INSTANCE, ilScript)); if (setupBadAttr) { - schema.getDocument().addField(createField("pos_zcurve", DataType.LONG, "{ attribute }")); + doc.addField(createField(doc, "pos_zcurve", DataType.LONG, "{ attribute }")); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsResolverTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsResolverTestCase.java index 324010f9e83..d1d3f4489ce 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsResolverTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsResolverTestCase.java @@ -110,13 +110,14 @@ public class ImportedFieldsResolverTestCase { public SearchModel() { super(); grandParentSchema = createSearch("grandparent"); - grandParentSchema.getDocument().addField(createField("ancient_field", DataType.INT, "{ attribute }")); - - parentSchema.getDocument().addField(createField("attribute_field", DataType.INT, "{ attribute }")); - parentSchema.getDocument().addField(createField("attribute_and_index", DataType.INT, "{ attribute | index }")); - parentSchema.getDocument().addField(new TemporarySDField("not_attribute", DataType.INT)); - parentSchema.getDocument().addField(createField("tensor_field", new TensorDataType(TensorType.fromSpec("tensor(x[5])")), "{ attribute }")); - parentSchema.getDocument().addField(createField("predicate_field", DataType.PREDICATE, "{ attribute }")); + var grandParentDoc = grandParentSchema.getDocument(); + grandParentDoc.addField(createField(grandParentDoc, "ancient_field", DataType.INT, "{ attribute }")); + var parentDoc = parentSchema.getDocument(); + parentDoc.addField(createField(parentDoc, "attribute_field", DataType.INT, "{ attribute }")); + parentDoc.addField(createField(parentDoc, "attribute_and_index", DataType.INT, "{ attribute | index }")); + parentDoc.addField(new TemporarySDField(parentDoc, "not_attribute", DataType.INT)); + parentDoc.addField(createField(parentDoc, "tensor_field", new TensorDataType(TensorType.fromSpec("tensor(x[5])")), "{ attribute }")); + parentDoc.addField(createField(parentDoc, "predicate_field", DataType.PREDICATE, "{ attribute }")); addRefField(parentSchema, grandParentSchema, "ref"); addImportedField(parentSchema, "ancient_field", "ref", "ancient_field"); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java index b14c7287537..3b4612ee87a 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java @@ -37,19 +37,19 @@ public class ParentChildSearchModel { return result; } - protected static TemporarySDField createField(String name, DataType dataType, String indexingScript) { - TemporarySDField result = new TemporarySDField(name, dataType); + protected static TemporarySDField createField(SDDocumentType repo, String name, DataType dataType, String indexingScript) { + TemporarySDField result = new TemporarySDField(repo, name, dataType); result.parseIndexingScript(indexingScript); return result; } @SuppressWarnings("deprecation") - protected static SDField createRefField(String parentType, String fieldName) { - return new TemporarySDField(fieldName, ReferenceDataType.createWithInferredId(TemporaryStructuredDataType.create(parentType))); + protected static SDField createRefField(SDDocumentType repo, String parentType, String fieldName) { + return new TemporarySDField(repo, fieldName, ReferenceDataType.createWithInferredId(TemporaryStructuredDataType.create(parentType))); } protected static void addRefField(Schema child, Schema parent, String fieldName) { - SDField refField = createRefField(parent.getName(), fieldName); + SDField refField = createRefField(child.getDocument(), parent.getName(), fieldName); child.getDocument().addField(refField); child.getDocument().setDocumentReferences(new DocumentReferences(ImmutableMap.of(refField.getName(), new DocumentReference(refField, parent)))); |