aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-01-26 13:26:47 +0100
committerJon Bratseth <bratseth@gmail.com>2022-01-26 13:26:47 +0100
commit5869796c08003f41f0ac8e4738414d136b075b1d (patch)
tree8576de9cb78f6d55e9477e07bb55f2bf51caeab2 /config-model
parent67f133794502e7499f8f8e36821a04a46622fdb9 (diff)
Modular rank profiles
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java16
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java79
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java4
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java2
-rw-r--r--config-model/src/test/derived/rankprofilemodularity/ilscripts.cfg0
-rw-r--r--config-model/src/test/derived/rankprofilemodularity/rank-profiles.cfg30
-rw-r--r--config-model/src/test/derived/rankprofilemodularity/test.sd4
-rw-r--r--config-model/src/test/derived/rankprofilemodularity/test/outside_schema1.profile6
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/AttributeSettingsTestCase.java24
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/DiversityTestCase.java6
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java10
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankPropertiesTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java12
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java12
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java16
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionValidationTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/UrlFieldValidationTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java10
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/SimpleInheritTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/StructInheritanceTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryMapTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/TwoStreamingStructsTestCase.java6
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java20
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/ReferenceFieldTestCase.java5
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderImportedFieldsTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderReferenceTypeTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java2
42 files changed, 202 insertions, 132 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java b/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java
index 72a8f004b22..637bbe91e67 100644
--- a/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java
+++ b/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java
@@ -33,6 +33,7 @@ import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.io.UncheckedIOException;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -145,7 +146,20 @@ public class MockApplicationPackage implements ApplicationPackage {
@Override
public List<NamedReader> getFiles(Path dir, String fileSuffix, boolean recurse) {
- return new ArrayList<>();
+ try {
+ File dirFile = new File(root, dir.getName());
+ if ( ! dirFile.exists()) return List.of();
+ if (recurse) throw new RuntimeException("Recurse not implemented");
+ List<NamedReader> readers = new ArrayList<>();
+ for (var i = Files.list(dirFile.toPath()).filter(p -> p.getFileName().toString().endsWith(fileSuffix)).iterator(); i.hasNext(); ) {
+ var file = i.next();
+ readers.add(new NamedReader(file.toString(), IOUtils.createReader(file.toString())));
+ }
+ return readers;
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
+ }
}
@Override
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java
index d75d940d491..ac4ac649a28 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java
@@ -12,6 +12,7 @@ import com.yahoo.config.model.test.MockApplicationPackage;
import com.yahoo.document.DocumentTypeManager;
import com.yahoo.io.IOUtils;
import com.yahoo.io.reader.NamedReader;
+import com.yahoo.path.Path;
import com.yahoo.search.query.profile.QueryProfileRegistry;
import com.yahoo.search.query.profile.config.QueryProfileXMLReader;
import com.yahoo.searchdefinition.parser.ParseException;
@@ -27,12 +28,10 @@ import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.nio.file.Files;
-import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -40,7 +39,7 @@ import java.util.Set;
* Application builder. Usage:
* 1) Add all schemas, using the addXXX() methods,
* 2) provide the available rank types and rank expressions, using the setRankXXX() methods,
- * 3) invoke the {@link #build()} method
+ * 3) invoke the {@link #build} method
*/
public class ApplicationBuilder {
@@ -143,13 +142,9 @@ public class ApplicationBuilder {
return addSchema(IOUtils.readFile(file), file.getAbsoluteFile().getParent());
}
- private Schema addSchemaFile(Path file) throws IOException, ParseException {
- return addSchemaFile(file.toString());
- }
-
/**
* Reads and parses the schema string provided by the given reader. Once all schemas have been
- * imported, call {@link #build()}.
+ * imported, call {@link #build}.
*
* @param reader the reader whose content to import
*/
@@ -187,12 +182,12 @@ public class ApplicationBuilder {
return addSchema(string, null);
}
- private Schema addSchema(String schemaString, String schemaDir) throws ParseException {
- return add(createSchema(schemaString, schemaDir));
+ private Schema addSchema(String schemaString, String schemaPath) throws ParseException {
+ return add(createSchema(schemaString, schemaPath));
}
/**
- * Registers the given schema to the application to be built during {@link #build()}. A
+ * Registers the given schema to the application to be built during {@link #build}. A
* {@link Schema} object is considered to be "raw" if it has not already been processed. This is the case for most
* programmatically constructed schemas used in unit tests.
*
@@ -206,13 +201,18 @@ public class ApplicationBuilder {
return schema;
}
- private Schema createSchema(String schemaString, String schemaDir) throws ParseException {
+ private Schema createSchema(String schemaString, String schemaPath) throws ParseException {
+ Schema schema = parseSchema(schemaString, schemaPath);
+ addRankProfileFiles(schema, schemaPath);
+ return schema;
+ }
+
+ private Schema parseSchema(String schemaString, String schemaPath) throws ParseException {
SimpleCharStream stream = new SimpleCharStream(schemaString);
try {
- Schema schema = new SDParser(stream, applicationPackage, fileRegistry, deployLogger, properties,
+ return new SDParser(stream, applicationPackage, fileRegistry, deployLogger, properties,
rankProfileRegistry, documentsOnly)
- .schema(documentTypeManager, schemaDir);
- return schema;
+ .schema(documentTypeManager, schemaPath);
} catch (TokenMgrException e) {
throw new ParseException("Unknown symbol: " + e.getMessage());
} catch (ParseException pe) {
@@ -220,16 +220,41 @@ public class ApplicationBuilder {
}
}
- /**
- * Processes and finalizes the schemas of this.
- * Only for testing.
- *
- * @throws IllegalStateException Thrown if this method has already been called.
- */
- public Application build() {
- return build(true);
+ private void addRankProfileFiles(Schema schema, String schemaPath) {
+ if (applicationPackage == null || schemaPath == null) return;
+ Path rankProfilePath = Path.fromString(schemaPath).append(schema.getName());
+ System.out.println("Adding external rank profiles for " + schema + ": Have " +
+ applicationPackage.getFiles(rankProfilePath, ".profile").size() +
+ " files in " + rankProfilePath);
+ for (NamedReader reader : applicationPackage.getFiles(rankProfilePath, ".profile")) {
+ parseRankProfile(reader, schema);
+ }
}
+ /** Parses the rank profile of the given reader and adds it to the rank profile registry for this schema. */
+ private void parseRankProfile(NamedReader reader, Schema schema) {
+ try {
+ SimpleCharStream stream = new SimpleCharStream(IOUtils.readAll(reader.getReader()));
+ try {
+ new SDParser(stream, applicationPackage, fileRegistry, deployLogger, properties,
+ rankProfileRegistry, documentsOnly)
+ .rankProfile(schema);
+ } catch (TokenMgrException e) {
+ throw new ParseException("Unknown symbol: " + e.getMessage());
+ } catch (ParseException pe) {
+ throw new ParseException(stream.formatException(Exceptions.toMessageString(pe)));
+ }
+ }
+ catch (IOException e) {
+ throw new IllegalArgumentException("Could not read rank profile " + reader.getName(), e);
+ }
+ catch (ParseException e) {
+ throw new IllegalArgumentException("Could not parse rank profile " + reader.getName(), e);
+ }
+ }
+
+
+
/**
* Processes and finalizes the schemas of this.
*
@@ -278,7 +303,7 @@ public class ApplicationBuilder {
* @param name the name of the schema to return,
* or null to return the only one or throw an exception if there are multiple to choose from
* @return the built object, or null if none with this name
- * @throws IllegalStateException if {@link #build()} has not been called.
+ * @throws IllegalStateException if {@link #build} has not been called.
*/
public Schema getSchema(String name) {
if (application == null) throw new IllegalStateException("Application not built");
@@ -426,8 +451,8 @@ public class ApplicationBuilder {
properties,
rankProfileRegistry,
queryProfileRegistry);
- for (Iterator<Path> i = Files.list(new File(dir).toPath()).filter(p -> p.getFileName().toString().endsWith(".sd")).iterator(); i.hasNext(); ) {
- builder.addSchemaFile(i.next());
+ for (var i = Files.list(new File(dir).toPath()).filter(p -> p.getFileName().toString().endsWith(".sd")).iterator(); i.hasNext(); ) {
+ builder.addSchemaFile(i.next().toString());
}
builder.build(true);
return builder;
@@ -499,7 +524,7 @@ public class ApplicationBuilder {
QueryProfileRegistry queryProfileRegistry) {
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry, queryProfileRegistry);
builder.add(rawSchema);
- builder.build();
+ builder.build(true);
return builder;
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
index 20234862643..1b6c4aa9459 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
@@ -216,8 +216,8 @@ public class RankProfile implements Cloneable {
inherited = resolveInherited();
if (inherited == null) {
String msg = "rank-profile '" + name() + "' inherits '" + inheritedName +
- "', but it does not exist anywhere in the inheritance of search '" +
- ((schema() != null) ? schema().getName() : " global rank profiles") + "'.";
+ "', but this is not found in " +
+ ((schema() != null) ? schema() : " global rank profiles");
throw new IllegalArgumentException(msg);
} else {
List<String> children = new ArrayList<>();
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java
index 475631f9241..bcdc9e656e1 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java
@@ -25,7 +25,7 @@ public class Deriver {
} catch (ParseException | IOException e) {
throw new IllegalArgumentException(e);
}
- builder.build();
+ builder.build(true);
return builder;
}
diff --git a/config-model/src/test/derived/rankprofilemodularity/ilscripts.cfg b/config-model/src/test/derived/rankprofilemodularity/ilscripts.cfg
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/config-model/src/test/derived/rankprofilemodularity/ilscripts.cfg
+++ /dev/null
diff --git a/config-model/src/test/derived/rankprofilemodularity/rank-profiles.cfg b/config-model/src/test/derived/rankprofilemodularity/rank-profiles.cfg
new file mode 100644
index 00000000000..8953a8b6bcf
--- /dev/null
+++ b/config-model/src/test/derived/rankprofilemodularity/rank-profiles.cfg
@@ -0,0 +1,30 @@
+rankprofile[].name "default"
+rankprofile[].name "unranked"
+rankprofile[].fef.property[].name "vespa.rank.firstphase"
+rankprofile[].fef.property[].value "value(0)"
+rankprofile[].fef.property[].name "vespa.hitcollector.heapsize"
+rankprofile[].fef.property[].value "0"
+rankprofile[].fef.property[].name "vespa.hitcollector.arraysize"
+rankprofile[].fef.property[].value "0"
+rankprofile[].fef.property[].name "vespa.dump.ignoredefaultfeatures"
+rankprofile[].fef.property[].value "true"
+rankprofile[].name "in_schema1"
+rankprofile[].fef.property[].name "vespa.rank.firstphase"
+rankprofile[].fef.property[].value "nativeRank"
+rankprofile[].name "in_schema2"
+rankprofile[].fef.property[].name "rankingExpression(fo2).rankingScript"
+rankprofile[].fef.property[].value "random"
+rankprofile[].fef.property[].name "rankingExpression(f2).rankingScript"
+rankprofile[].fef.property[].value "fieldMatch(title) + rankingExpression(fo2)"
+rankprofile[].fef.property[].name "vespa.rank.firstphase"
+rankprofile[].fef.property[].value "rankingExpression(f2)"
+rankprofile[].name "outside_schema1"
+rankprofile[].fef.property[].name "rankingExpression(fo1).rankingScript"
+rankprofile[].fef.property[].value "now"
+rankprofile[].fef.property[].name "vespa.rank.firstphase"
+rankprofile[].fef.property[].value "nativeRank"
+rankprofile[].name "outside_schema2"
+rankprofile[].fef.property[].name "rankingExpression(fo2).rankingScript"
+rankprofile[].fef.property[].value "random"
+rankprofile[].fef.property[].name "vespa.rank.firstphase"
+rankprofile[].fef.property[].value "fieldMatch(title).completeness"
diff --git a/config-model/src/test/derived/rankprofilemodularity/test.sd b/config-model/src/test/derived/rankprofilemodularity/test.sd
index 29f39bef59d..720e2143f17 100644
--- a/config-model/src/test/derived/rankprofilemodularity/test.sd
+++ b/config-model/src/test/derived/rankprofilemodularity/test.sd
@@ -18,12 +18,12 @@ schema test {
rank-profile in_schema2 inherits outside_schema2 {
- function f1() {
+ function f2() {
expression: fieldMatch(title) + fo2
}
first-phase {
- expression: f1
+ expression: f2
}
}
diff --git a/config-model/src/test/derived/rankprofilemodularity/test/outside_schema1.profile b/config-model/src/test/derived/rankprofilemodularity/test/outside_schema1.profile
index 8e9782da119..a8092689b7f 100644
--- a/config-model/src/test/derived/rankprofilemodularity/test/outside_schema1.profile
+++ b/config-model/src/test/derived/rankprofilemodularity/test/outside_schema1.profile
@@ -1,11 +1,7 @@
-rank-profile outside_schema1 {
+rank-profile outside_schema1 inherits in_schema1 {
function fo1() {
expression: now
}
- first-phase {
- expression: fieldMatch(title).completeness
- }
-
} \ No newline at end of file
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/AttributeSettingsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/AttributeSettingsTestCase.java
index 819a6f54b23..7b2ed2d7a7f 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/AttributeSettingsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/AttributeSettingsTestCase.java
@@ -98,15 +98,15 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
assertTrue(attr.isFastAccess());
}
- private Schema getSearch(String sd) throws ParseException {
+ private Schema getSchema(String sd) throws ParseException {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchema(sd);
- builder.build();
+ builder.build(true);
return builder.getSchema();
}
private Attribute getAttributeF(String sd) throws ParseException {
- Schema schema = getSearch(sd);
+ Schema schema = getSchema(sd);
SDField field = (SDField) schema.getDocument().getField("f");
return field.getAttributes().get(field.getName());
}
@@ -153,14 +153,14 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
@Test
public void requireThatMutableCanNotbeSetInDocument() throws ParseException {
try {
- getSearch("search test {\n" +
- " document test {\n" +
- " field f type int {\n" +
- " indexing: attribute\n" +
- " attribute: mutable\n" +
- " }\n" +
- " }\n" +
- "}\n");
+ getSchema("search test {\n" +
+ " document test {\n" +
+ " field f type int {\n" +
+ " indexing: attribute\n" +
+ " attribute: mutable\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
fail();
} catch (IllegalArgumentException e) {
assertEquals("Field 'f' in 'test' can not be marked mutable as it is inside the document clause.", e.getMessage());
@@ -185,7 +185,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
}
private Schema getSearchWithMutables() throws ParseException {
- return getSearch(
+ return getSchema(
"search test {\n" +
" document test { \n" +
" field a type int { \n" +
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/DiversityTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/DiversityTestCase.java
index 6d39a64cb21..ca7313a5c3f 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/DiversityTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/DiversityTestCase.java
@@ -42,7 +42,7 @@ public class DiversityTestCase {
" }\n" +
" }\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile.MatchPhaseSettings matchPhase = rankProfileRegistry.get(s, "parent").getMatchPhaseSettings();
RankProfile.DiversitySettings diversity = matchPhase.getDiversity();
@@ -63,7 +63,7 @@ public class DiversityTestCase {
ApplicationBuilder builder = getSearchBuilder("field b type predicate { indexing: attribute }");
try {
- builder.build();
+ builder.build(true);
fail("Should throw.");
} catch (IllegalArgumentException e) {
assertEquals(getMessagePrefix() + "must be single value numeric, or enumerated attribute, but it is 'predicate'", e.getMessage());
@@ -75,7 +75,7 @@ public class DiversityTestCase {
ApplicationBuilder builder = getSearchBuilder("field b type array<int> { indexing: attribute }");
try {
- builder.build();
+ builder.build(true);
fail("Should throw.");
} catch (IllegalArgumentException e) {
assertEquals(getMessagePrefix() + "must be single value numeric, or enumerated attribute, but it is 'Array<int>'", e.getMessage());
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
index 4ebbf3f18cd..c88e8149e46 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
@@ -79,7 +79,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
builder.build(true);
fail();
} catch (IllegalArgumentException e) {
- assertEquals("rank-profile 'p1' inherits 'notexist', but it does not exist anywhere in the inheritance of search 'test'.", e.getMessage());
+ assertEquals("rank-profile 'p1' inherits 'notexist', but this is not found in schema 'test'", e.getMessage());
}
}
@@ -166,7 +166,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
builder.build(true);
fail("Sideways inheritance should have been enforced");
} catch (IllegalArgumentException e) {
- assertEquals("rank-profile 'child' inherits 'parent', but it does not exist anywhere in the inheritance of search 'child1'.", e.getMessage());
+ assertEquals("rank-profile 'child' inherits 'parent', but this is not found in schema 'child1'", e.getMessage());
}
}
@@ -249,7 +249,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(sd);
- builder.build();
+ builder.build(true);
Schema schema = builder.getSchema();
AttributeFields attributeFields = new AttributeFields(schema);
verifyRankProfile(rankProfileRegistry.get(schema, "parent"), attributeFields, deployProperties, termwiseLimit);
@@ -291,7 +291,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
" rank-profile p1 {}",
" rank-profile p2 {}",
"}"));
- builder.build();
+ builder.build(true);
Schema schema = builder.getSchema();
assertEquals(4, registry.all().size());
@@ -311,7 +311,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
" field a type tensor(x[]) { indexing: attribute }",
" }",
"}"));
- builder.build();
+ builder.build(true);
}
catch (IllegalArgumentException e) {
assertEquals("Illegal type in field a type tensor(x[]): Dense tensor dimensions must have a size",
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankPropertiesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankPropertiesTestCase.java
index 963c91c8c23..6de890549c1 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankPropertiesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankPropertiesTestCase.java
@@ -48,7 +48,7 @@ public class RankPropertiesTestCase extends AbstractSchemaTestCase {
" }",
" }",
"}"));
- builder.build();
+ builder.build(true);
Schema schema = builder.getSchema();
AttributeFields attributeFields = new AttributeFields(schema);
@@ -128,7 +128,7 @@ public class RankPropertiesTestCase extends AbstractSchemaTestCase {
" }",
" }",
"}"));
- builder.build();
+ builder.build(true);
Schema schema = builder.getSchema();
RankProfile a = rankProfileRegistry.get(schema, "a");
List<RankProfile.MutateOperation> operations = a.getMutateOperations();
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java
index 78897bd612f..6eb74dede62 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java
@@ -43,7 +43,7 @@ public class RankingConstantTest {
" }",
"}"
));
- schemaBuilder.build();
+ schemaBuilder.build(true);
Schema schema = schemaBuilder.getSchema();
Iterator<RankingConstant> constantIterator = schema.rankingConstants().asMap().values().iterator();
@@ -101,7 +101,7 @@ public class RankingConstantTest {
" }",
"}"
));
- schemaBuilder.build();
+ schemaBuilder.build(true);
Schema schema = schemaBuilder.getSchema();
RankingConstant constant = schema.rankingConstants().asMap().values().iterator().next();
assertEquals("simplename", constant.getFileName());
@@ -120,7 +120,7 @@ public class RankingConstantTest {
" }",
"}"
));
- schemaBuilder.build();
+ schemaBuilder.build(true);
Schema schema = schemaBuilder.getSchema();
RankingConstant constant = schema.rankingConstants().asMap().values().iterator().next();
assertEquals(RankingConstant.PathType.URI, constant.getPathType());
@@ -140,7 +140,7 @@ public class RankingConstantTest {
" }",
"}"
));
- schemaBuilder.build();
+ schemaBuilder.build(true);
Schema schema = schemaBuilder.getSchema();
RankingConstant constant = schema.rankingConstants().asMap().values().iterator().next();
assertEquals(RankingConstant.PathType.URI, constant.getPathType());
@@ -160,7 +160,7 @@ public class RankingConstantTest {
" }",
"}"
));
- schemaBuilder.build();
+ schemaBuilder.build(true);
Schema schema = schemaBuilder.getSchema();
RankingConstant constant = schema.rankingConstants().asMap().values().iterator().next();
assertEquals(RankingConstant.PathType.URI, constant.getPathType());
@@ -180,7 +180,7 @@ public class RankingConstantTest {
" }",
"}"
));
- schemaBuilder.build();
+ schemaBuilder.build(true);
Schema schema = schemaBuilder.getSchema();
RankingConstant constant = schema.rankingConstants().asMap().values().iterator().next();
assertEquals(RankingConstant.PathType.URI, constant.getPathType());
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java
index 19e471bacd3..4646ff2f394 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java
@@ -66,7 +66,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile parent = rankProfileRegistry.get(s, "parent").compile(queryProfileRegistry, new ImportedMlModels());
assertEquals("0.0", parent.getFirstPhaseRanking().getRoot().toString());
@@ -110,7 +110,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
try {
rankProfileRegistry.get(s, "test").compile(new QueryProfileRegistry(), new ImportedMlModels());
@@ -141,7 +141,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile profile = rankProfileRegistry.get(s, "test");
assertEquals("safeLog(popShareSlowDecaySignal,-9.21034037)", profile.getFunctions().get("POP_SLOW_SCORE").function().getBody().getRoot().toString());
@@ -169,7 +169,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile profile = rankProfileRegistry.get(s, "test");
assertEquals("safeLog(popShareSlowDecaySignal,myValue)", profile.getFunctions().get("POP_SLOW_SCORE").function().getBody().getRoot().toString());
@@ -193,7 +193,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile profile = rankProfileRegistry.get(s, "test");
assertEquals("k1 + (k2 + k3) / 1.0E8",
@@ -219,7 +219,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile profile = rankProfileRegistry.get(s, "test");
assertEquals("0.5 + 50 * (attribute(rating_yelp) - 3)",
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java
index ab4cd3d2275..94d25deb16a 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java
@@ -65,7 +65,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile parent = rankProfileRegistry.get(s, "parent").compile(new QueryProfileRegistry(), new ImportedMlModels());
@@ -125,7 +125,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile parent = rankProfileRegistry.get(s, "parent").compile(new QueryProfileRegistry(), new ImportedMlModels());
@@ -181,7 +181,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile test = rankProfileRegistry.get(s, "test").compile(new QueryProfileRegistry(), new ImportedMlModels());
@@ -215,7 +215,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase {
" }\n" +
" }\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile test = rankProfileRegistry.get(s, "test").compile(new QueryProfileRegistry(), new ImportedMlModels());
assertEquals("foo(2)", test.getFirstPhaseRanking().getRoot().toString());
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java
index 1e108a51a07..ff8a9df4076 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java
@@ -36,7 +36,7 @@ public class RankingExpressionLoopDetectionTestCase {
"\n" +
"}\n");
try {
- builder.build();
+ builder.build(true);
fail("Excepted exception");
}
catch (IllegalArgumentException e) {
@@ -71,7 +71,7 @@ public class RankingExpressionLoopDetectionTestCase {
"\n" +
"}\n");
try {
- builder.build();
+ builder.build(true);
fail("Excepted exception");
}
catch (IllegalArgumentException e) {
@@ -106,7 +106,7 @@ public class RankingExpressionLoopDetectionTestCase {
"\n" +
"}\n");
try {
- builder.build();
+ builder.build(true);
fail("Excepted exception");
}
catch (IllegalArgumentException e) {
@@ -140,7 +140,7 @@ public class RankingExpressionLoopDetectionTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
}
@Test
@@ -168,7 +168,7 @@ public class RankingExpressionLoopDetectionTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
}
@Test
@@ -191,7 +191,7 @@ public class RankingExpressionLoopDetectionTestCase {
" }\n" +
" }\n" +
"}\n");
- builder.build();
+ builder.build(true);
}
@Test
@@ -214,7 +214,7 @@ public class RankingExpressionLoopDetectionTestCase {
" }\n" +
" }\n" +
"}\n");
- builder.build();
+ builder.build(true);
}
@Test
@@ -240,7 +240,7 @@ public class RankingExpressionLoopDetectionTestCase {
" }\n" +
" }\n" +
"}\n");
- builder.build();
+ builder.build(true);
}
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java
index 76fc7118d45..8354eb59416 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java
@@ -45,7 +45,7 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile test = rankProfileRegistry.get(s, "test").compile(new QueryProfileRegistry(), new ImportedMlModels());
List<Pair<String, String>> testRankProperties = createRawRankProfile(test, new QueryProfileRegistry(), s).configProperties();
@@ -86,7 +86,7 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile test = rankProfileRegistry.get(s, "test").compile(new QueryProfileRegistry(), new ImportedMlModels());
List<Pair<String, String>> testRankProperties = createRawRankProfile(test, new QueryProfileRegistry(), s).configProperties();
@@ -132,7 +132,7 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase {
" }\n" +
"\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile test = rankProfileRegistry.get(s, "test").compile(new QueryProfileRegistry(), new ImportedMlModels());
List<Pair<String, String>> testRankProperties = createRawRankProfile(test, new QueryProfileRegistry(), s).configProperties();
@@ -193,7 +193,7 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase {
" file: ignored.json\n" +
" }\n" +
"}\n");
- builder.build();
+ builder.build(true);
Schema s = builder.getSchema();
RankProfile test = rankProfileRegistry.get(s, "test").compile(queryProfiles, new ImportedMlModels());
List<Pair<String, String>> testRankProperties = createRawRankProfile(test, queryProfiles, s).configProperties();
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionValidationTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionValidationTestCase.java
index 48c3e8e74b7..ee3b4ab25e0 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionValidationTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionValidationTestCase.java
@@ -45,7 +45,7 @@ public class RankingExpressionValidationTestCase extends AbstractSchemaTestCase
" }" +
" }" +
"}");
- builder.build();
+ builder.build(true);
return builder.getSchema();
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java
index 1d01fd8cafa..8a9300a83eb 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java
@@ -38,7 +38,7 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder sb = new ApplicationBuilder(rankProfileRegistry, new QueryProfileRegistry());
sb.addSchemaFile("src/test/examples/simple.sd");
- sb.build();
+ sb.build(true);
Schema schema = sb.getSchema();
assertEquals("simple", schema.getName());
assertTrue(schema.hasDocument());
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/UrlFieldValidationTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/UrlFieldValidationTestCase.java
index c5ead2b4064..f2d78796553 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/UrlFieldValidationTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/UrlFieldValidationTestCase.java
@@ -22,7 +22,7 @@ public class UrlFieldValidationTestCase {
" }" +
"}");
try {
- builder.build();
+ builder.build(true);
fail("Should have caused an exception");
// success
} catch (IllegalArgumentException e) {
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java
index 7f913ef5b5f..a88ad929e80 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java
@@ -115,7 +115,7 @@ public abstract class AbstractExportingTestCase extends AbstractSchemaTestCase {
* This will fail if the builder contains multiple search definitions.
*/
protected DerivedConfiguration assertCorrectDeriving(ApplicationBuilder builder, String dirName, DeployLogger logger) throws IOException {
- builder.build();
+ builder.build(true);
DerivedConfiguration derived = derive(dirName, null, new TestProperties(), builder, logger);
assertCorrectConfigFiles(dirName);
return derived;
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java
index 48f0c862468..ddb627216b7 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java
@@ -147,7 +147,7 @@ public class ExportingTestCase extends AbstractExportingTestCase {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchemaFile(dir + "first.sd");
builder.addSchemaFile(dir + "second.sd");
- builder.build();
+ builder.build(true);
derive("tensor2", builder, builder.getSchema("second"));
assertCorrectConfigFiles("tensor2");
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java
index 13de3f95fa5..bcf68387294 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java
@@ -44,7 +44,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchemaFile(dir + "parent.sd");
builder.addSchemaFile(dir + "child.sd");
- builder.build();
+ builder.build(true);
derive("inheritstruct", builder, builder.getSchema("child"));
assertCorrectConfigFiles("inheritstruct");
}
@@ -69,7 +69,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
String fileName = files.get(fileIdx % files.size());
builder.addSchemaFile(dir + fileName);
}
- builder.build();
+ builder.build(true);
DocumentmanagerConfig.Builder b = new DocumentmanagerConfig.Builder();
DerivedConfiguration.exportDocuments(new DocumentManager().produce(builder.getModel(), b), outDir.getPath());
DocumentmanagerConfig dc = b.build();
@@ -114,7 +114,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchemaFile(dir + "parent.sd");
builder.addSchemaFile(dir + "child.sd");
- builder.build();
+ builder.build(true);
derive("inheritfromparent", builder, builder.getSchema("child"));
assertCorrectConfigFiles("inheritfromparent");
}
@@ -126,7 +126,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
builder.addSchemaFile(dir + "grandparent.sd");
builder.addSchemaFile(dir + "parent.sd");
builder.addSchemaFile(dir + "child.sd");
- builder.build();
+ builder.build(true);
derive("inheritfromgrandparent", builder, builder.getSchema("child"));
assertCorrectConfigFiles("inheritfromgrandparent");
}
@@ -139,7 +139,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
builder.addSchemaFile(dir + "father.sd");
builder.addSchemaFile(dir + "mother.sd");
builder.addSchemaFile(dir + "child.sd");
- builder.build();
+ builder.build(true);
derive("inheritance", builder, builder.getSchema("child"));
assertCorrectConfigFiles("inheritance");
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SimpleInheritTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SimpleInheritTestCase.java
index 8a4e403072b..d89e5f2c957 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SimpleInheritTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SimpleInheritTestCase.java
@@ -22,7 +22,7 @@ public class SimpleInheritTestCase extends AbstractExportingTestCase {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchemaFile(expectedResultsDirName + "parent.sd");
builder.addSchemaFile(expectedResultsDirName + "child.sd");
- builder.build();
+ builder.build(true);
Schema schema = builder.getSchema("child");
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/StructInheritanceTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/StructInheritanceTestCase.java
index c684ec17e42..1f6c70c9383 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/StructInheritanceTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/StructInheritanceTestCase.java
@@ -45,7 +45,7 @@ public class StructInheritanceTestCase extends AbstractExportingTestCase {
String dir = "src/test/derived/structinheritance/";
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchemaFile(dir + "bad.sd");
- builder.build();
+ builder.build(true);
derive("structinheritance", builder, builder.getSchema("bad"));
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryMapTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryMapTestCase.java
index fa8a31befc4..c0fa3e8311f 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryMapTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryMapTestCase.java
@@ -196,7 +196,7 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase {
field,
" }",
"}"));
- builder.build();
+ builder.build(true);
return builder.getSchema();
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java
index b18b2120212..9a36ef90cd7 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java
@@ -149,7 +149,7 @@ public class SummaryTestCase extends AbstractSchemaTestCase {
" summary other_campaign_ref type reference<campaign> {}",
" }",
"}"));
- builder.build();
+ builder.build(true);
return builder.getSchema("ad");
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/TwoStreamingStructsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/TwoStreamingStructsTestCase.java
index 53948e2d5c8..4e629fcb4d8 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/TwoStreamingStructsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/TwoStreamingStructsTestCase.java
@@ -13,6 +13,7 @@ import java.io.IOException;
* @author arnej27959
*/
public class TwoStreamingStructsTestCase extends AbstractExportingTestCase {
+
@Test
public void testTwoStreamingStructsExporting() throws ParseException, IOException {
@@ -20,13 +21,14 @@ public class TwoStreamingStructsTestCase extends AbstractExportingTestCase {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchemaFile(root + "/streamingstruct.sd");
builder.addSchemaFile(root + "/whatever.sd");
- builder.build();
+ builder.build(true);
assertCorrectDeriving(builder, builder.getSchema("streamingstruct"), root);
builder = new ApplicationBuilder();
builder.addSchemaFile(root + "/streamingstruct.sd");
builder.addSchemaFile(root + "/whatever.sd");
- builder.build();
+ builder.build(true);
assertCorrectDeriving(builder, builder.getSchema("streamingstruct"), root);
}
+
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java
index 3bdda1ea0d8..b03aff455c5 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java
@@ -51,7 +51,7 @@ public class DisallowComplexMapAndWsetKeyTypesTestCase {
" field a type " + fieldType + " {}\n" +
" }\n" +
"}\n");
- builder.build();
+ builder.build(true);
}
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java
index 6e01909ea44..0c25cef49a1 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java
@@ -55,7 +55,7 @@ public class FastAccessValidatorTest {
"For schema 'test': The following attributes have a type that is incompatible " +
"with fast-access: predicate_attribute, tensor_attribute, reference_attribute. " +
"Predicate, tensor and reference attributes are incompatible with fast-access.");
- builder.build();
+ builder.build(true);
}
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java
index cfc1779ded0..b0b9ce81cc7 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java
@@ -84,7 +84,7 @@ public class ImplicitSchemaFieldsTestCase extends AbstractSchemaTestCase {
public void testRequireThatDerivedConfigurationWorks() throws IOException, ParseException {
ApplicationBuilder sb = new ApplicationBuilder();
sb.addSchemaFile("src/test/examples/nextgen/simple.sd");
- sb.build();
+ sb.build(true);
assertNotNull(sb.getSchema());
new DerivedConfiguration(sb.getSchema(), sb.getRankProfileRegistry());
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java
index e87ecd3294f..b15b81b717d 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java
@@ -82,7 +82,7 @@ public class ImportedFieldsTestCase {
" }",
"}"));
builder.addSchema(sdContent);
- builder.build();
+ builder.build(true);
return builder.getSchema("ad");
}
@@ -315,7 +315,7 @@ public class ImportedFieldsTestCase {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchema(parentSdContent);
builder.addSchema(sdContent);
- builder.build();
+ builder.build(true);
return builder.getSchema("child");
}
@@ -324,7 +324,7 @@ public class ImportedFieldsTestCase {
builder.addSchema(grandParentSdContent);
builder.addSchema(parentSdContent);
builder.addSchema(sdContent);
- builder.build();
+ builder.build(true);
return builder.getSchema("child");
}
@@ -522,7 +522,7 @@ public class ImportedFieldsTestCase {
"import field ref_parent_b.entries as entries_from_b {}",
"}"));
- builder.build();
+ builder.build(true);
return builder;
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java
index ea5102baf17..b48927d58a3 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java
@@ -186,7 +186,7 @@ public class MatchedElementsOnlyResolverTestCase {
" }",
summary,
"}"));
- builder.build();
+ builder.build(true);
return builder.getSchema();
}
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java
index dbf339dee4b..2d0bdb58122 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java
@@ -78,7 +78,7 @@ class RankProfileSearchFixture {
"\n" +
"}";
builder.addSchema(sdContent);
- builder.build();
+ builder.build(true);
schema = builder.getSchema();
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java
index ec8d9bc4261..7f5e8f8753a 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java
@@ -48,7 +48,7 @@ public class RankingExpressionTypeResolverTestCase {
" }",
"}"
));
- builder.build();
+ builder.build(true);
fail("Expected exception");
}
catch (IllegalArgumentException expected) {
@@ -96,7 +96,7 @@ public class RankingExpressionTypeResolverTestCase {
" }",
"}"
));
- builder.build();
+ builder.build(true);
fail("Expected exception");
}
catch (IllegalArgumentException expected) {
@@ -128,7 +128,7 @@ public class RankingExpressionTypeResolverTestCase {
" }",
"}"
));
- builder.build();
+ builder.build(true);
fail("Expected exception");
}
catch (IllegalArgumentException expected) {
@@ -158,7 +158,7 @@ public class RankingExpressionTypeResolverTestCase {
" }",
"}"
));
- schemaBuilder.build();
+ schemaBuilder.build(true);
fail("Expected exception");
}
catch (IllegalArgumentException expected) {
@@ -194,7 +194,7 @@ public class RankingExpressionTypeResolverTestCase {
" }",
"}"
));
- builder.build();
+ builder.build(true);
RankProfile profile =
builder.getRankProfileRegistry().get(builder.getSchema(), "my_rank_profile");
assertEquals(TensorType.fromSpec("tensor(x[10],y[3])"),
@@ -236,7 +236,7 @@ public class RankingExpressionTypeResolverTestCase {
" }",
"}"
));
- builder.build();
+ builder.build(true);
RankProfile profile =
builder.getRankProfileRegistry().get(builder.getSchema(), "my_rank_profile");
assertEquals(TensorType.fromSpec("tensor(x[10],y[1])"),
@@ -280,7 +280,7 @@ public class RankingExpressionTypeResolverTestCase {
" first-phase { expression: commonfirstphase(eustaticrank) }",
" }",
"}"));
- builder.build();
+ builder.build(true);
RankProfile profile = builder.getRankProfileRegistry().get(builder.getSchema(), "eurank");
}
@@ -320,7 +320,7 @@ public class RankingExpressionTypeResolverTestCase {
" }",
"}"
));
- builder.build();
+ builder.build(true);
RankProfile profile =
builder.getRankProfileRegistry().get(builder.getSchema(), "my_rank_profile");
assertEquals(TensorType.fromSpec("tensor(x[10],y[1])"),
@@ -345,7 +345,7 @@ public class RankingExpressionTypeResolverTestCase {
" summary-features { test_func_via_func_with_expr }",
" }",
"}"));
- builder.build();
+ builder.build(true);
RankProfile profile = builder.getRankProfileRegistry().get(builder.getSchema(), "test");
assertEquals(TensorType.fromSpec("tensor<float>(y{})"),
summaryFeatures(profile).get("test_func_via_func_with_expr").type(profile.typeContext(builder.getQueryProfileRegistry())));
@@ -378,7 +378,7 @@ public class RankingExpressionTypeResolverTestCase {
" }",
"}"
));
- builder.build();
+ builder.build(true);
}
@Test
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java
index 09aa09a626b..2a9d64767ba 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java
@@ -399,8 +399,10 @@ public class RankingExpressionWithOnnxTestCase {
@Override
public List<NamedReader> getFiles(Path path, String suffix) {
+ File[] files = getFileReference(path).listFiles();
+ if (files == null) return List.of();
List<NamedReader> readers = new ArrayList<>();
- for (File file : getFileReference(path).listFiles()) {
+ for (File file : files) {
if ( ! file.getName().endsWith(suffix)) continue;
try {
readers.add(new NamedReader(file.getName(), new FileReader(file)));
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java
index 1cdc0aef1cc..ffc073ed434 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java
@@ -89,7 +89,7 @@ public class RankingExpressionWithTransformerTokensTestCase {
"}";
ApplicationBuilder schemaBuilder = new ApplicationBuilder(application, new MockFileRegistry(), new BaseDeployLogger(), new TestProperties(), rankProfileRegistry, queryProfileRegistry);
schemaBuilder.addSchema(sdContent);
- schemaBuilder.build();
+ schemaBuilder.build(true);
Schema schema = schemaBuilder.getSchema();
RankProfile rp = rankProfileRegistry.get(schema, "my_profile");
return new RankProfileTransformContext(rp, queryProfileRegistry, Collections.emptyMap(), null, Collections.emptyMap(), Collections.emptyMap());
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReferenceFieldTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReferenceFieldTestCase.java
index a2da13b3749..d60cb9040d8 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReferenceFieldTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReferenceFieldTestCase.java
@@ -49,7 +49,7 @@ public class ReferenceFieldTestCase {
builder.addSchema(campaignSdContent);
builder.addSchema(salespersonSdContent);
builder.addSchema(adSdContent);
- builder.build();
+ builder.build(true);
Schema schema = builder.getSchema("ad");
assertSearchContainsReferenceField("campaign_ref", "campaign", schema.getDocument());
assertSearchContainsReferenceField("salesperson_ref", "salesperson", schema.getDocument());
@@ -74,7 +74,7 @@ public class ReferenceFieldTestCase {
builder.addSchema(adSdContent);
exceptionRule.expect(DocumentGraphValidator.DocumentGraphException.class);
exceptionRule.expectMessage("Document dependency cycle detected: campaign->ad->campaign.");
- builder.build();
+ builder.build(true);
}
private static void assertSearchContainsReferenceField(String expectedFieldname,
@@ -87,4 +87,5 @@ public class ReferenceFieldTestCase {
ReferenceDataType refField = (ReferenceDataType) dataType;
assertEquals(referencedDocType, refField.getTargetType().getName());
}
+
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderImportedFieldsTestCase.java b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderImportedFieldsTestCase.java
index ad8e096e39c..33d84cf4313 100644
--- a/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderImportedFieldsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderImportedFieldsTestCase.java
@@ -47,7 +47,7 @@ public class DocumentModelBuilderImportedFieldsTestCase extends AbstractReferenc
}
public DocumentModel build(String adSdContent) throws ParseException {
builder.addSchema(adSdContent);
- builder.build();
+ builder.build(true);
return builder.getModel();
}
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderReferenceTypeTestCase.java b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderReferenceTypeTestCase.java
index febe0ecc8cd..00f39a23a8f 100644
--- a/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderReferenceTypeTestCase.java
+++ b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderReferenceTypeTestCase.java
@@ -71,7 +71,7 @@ public class DocumentModelBuilderReferenceTypeTestCase extends AbstractReference
}
public DocumentModel build(String adSdContent) throws ParseException {
builder.addSchema(adSdContent);
- builder.build();
+ builder.build(true);
return builder.getModel();
}
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderTestCase.java b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderTestCase.java
index 857a1499264..dc88590a198 100644
--- a/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderTestCase.java
+++ b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderTestCase.java
@@ -38,7 +38,7 @@ public class DocumentModelBuilderTestCase extends AbstractSchemaTestCase {
ApplicationBuilder search = new ApplicationBuilder();
search.addSchemaFile("src/test/configmodel/types/other_doc.sd");
search.addSchemaFile("src/test/configmodel/types/type_with_doc_field.sd");
- search.build();
+ search.build(true);
DocumentModel model = search.getModel();
DocumenttypesConfig.Builder documenttypesCfg = new DocumentTypes().produce(model, new DocumenttypesConfig.Builder());
@@ -52,7 +52,7 @@ public class DocumentModelBuilderTestCase extends AbstractSchemaTestCase {
search.addSchemaFile("src/test/cfg/search/data/travel/schemas/TTData.sd");
search.addSchemaFile("src/test/cfg/search/data/travel/schemas/TTEdge.sd");
search.addSchemaFile("src/test/cfg/search/data/travel/schemas/TTPOI.sd");
- search.build();
+ search.build(true);
}
private DocumentModel createAndTestModel(String sd) throws IOException, ParseException {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java
index 27c2e5f8937..e58c29cc4fd 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java
@@ -60,7 +60,7 @@ public class SchemaClusterTest {
ApplicationBuilder builder = new ApplicationBuilder();
builder.add(schema1);
builder.add(schema2);
- builder.build();
+ builder.build(true);
}
@Test