diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-10-15 19:00:17 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-10-15 19:00:17 +0200 |
commit | cf7c0cb612a2cbc1cd63e7043eae28e5a5ecba06 (patch) | |
tree | 38309e09d8ec0f4ebbf702343b3f0a7590dbcaa1 /config-model/src/test/java/com/yahoo/searchdefinition/derived | |
parent | 813c270c2ea80953c7b09aac56dc6a5c254aca1e (diff) |
search -> schema
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition/derived')
14 files changed, 126 insertions, 126 deletions
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 5d0e69f9ac4..a517f2544a6 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 @@ -7,7 +7,7 @@ import com.yahoo.config.model.application.provider.MockFileRegistry; import com.yahoo.config.model.deploy.TestProperties; import com.yahoo.document.DocumenttypesConfig; import com.yahoo.document.config.DocumentmanagerConfig; -import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.SearchBuilder; import com.yahoo.searchdefinition.SchemaTestCase; import com.yahoo.searchdefinition.parser.ParseException; @@ -54,8 +54,8 @@ public abstract class AbstractExportingTestCase extends SchemaTestCase { return export(dirName, builder, config); } - DerivedConfiguration derive(String dirName, SearchBuilder builder, Search search) throws IOException { - DerivedConfiguration config = new DerivedConfiguration(search, + DerivedConfiguration derive(String dirName, SearchBuilder builder, Schema schema) throws IOException { + DerivedConfiguration config = new DerivedConfiguration(schema, builder.getRankProfileRegistry(), builder.getQueryProfileRegistry()); return export(dirName, builder, config); @@ -117,8 +117,8 @@ public abstract class AbstractExportingTestCase extends SchemaTestCase { return derived; } - protected DerivedConfiguration assertCorrectDeriving(SearchBuilder builder, Search search, String name) throws IOException { - DerivedConfiguration derived = derive(name, builder, search); + protected DerivedConfiguration assertCorrectDeriving(SearchBuilder builder, Schema schema, String name) throws IOException { + DerivedConfiguration derived = derive(name, builder, schema); assertCorrectConfigFiles(name); return derived; } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/AttributeListTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/AttributeListTestCase.java index c36a682fbd8..43dfb9f3bc5 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/AttributeListTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/AttributeListTestCase.java @@ -1,7 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchdefinition.derived; -import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.SearchBuilder; import com.yahoo.searchdefinition.SchemaTestCase; import com.yahoo.searchdefinition.document.Attribute; @@ -25,10 +25,10 @@ public class AttributeListTestCase extends SchemaTestCase { @Test public void testDeriving() throws IOException, ParseException { // Test attribute importing - Search search = SearchBuilder.buildFromFile("src/test/examples/simple.sd"); + Schema schema = SearchBuilder.buildFromFile("src/test/examples/simple.sd"); // Test attribute deriving - AttributeFields attributeFields = new AttributeFields(search); + AttributeFields attributeFields = new AttributeFields(schema); Iterator attributes = attributeFields.attributeIterator(); Attribute attribute; attribute = (Attribute)attributes.next(); @@ -71,8 +71,8 @@ public class AttributeListTestCase extends SchemaTestCase { @Test public void fields_in_array_of_struct_are_derived_into_array_attributes() throws IOException, ParseException { - Search search = SearchBuilder.buildFromFile("src/test/derived/array_of_struct_attribute/test.sd"); - Iterator<Attribute> attributes = new AttributeFields(search).attributeIterator(); + Schema schema = SearchBuilder.buildFromFile("src/test/derived/array_of_struct_attribute/test.sd"); + Iterator<Attribute> attributes = new AttributeFields(schema).attributeIterator(); assertAttribute("elem_array.name", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, true, attributes.next()); assertAttribute("elem_array.weight", Attribute.Type.INTEGER, Attribute.CollectionType.ARRAY, false, attributes.next()); @@ -81,8 +81,8 @@ public class AttributeListTestCase extends SchemaTestCase { @Test public void fields_in_map_of_struct_are_derived_into_array_attributes() throws IOException, ParseException { - Search search = SearchBuilder.buildFromFile("src/test/derived/map_of_struct_attribute/test.sd"); - Iterator<Attribute> attributes = new AttributeFields(search).attributeIterator(); + Schema schema = SearchBuilder.buildFromFile("src/test/derived/map_of_struct_attribute/test.sd"); + Iterator<Attribute> attributes = new AttributeFields(schema).attributeIterator(); assertAttribute("str_elem_map.key", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, true, attributes.next()); assertAttribute("str_elem_map.value.name", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, false, attributes.next()); @@ -101,7 +101,7 @@ public class AttributeListTestCase extends SchemaTestCase { @Test public void only_zcurve_attribute_is_derived_from_array_of_position_field() throws ParseException { - Search search = SearchBuilder.createFromString( + Schema schema = SearchBuilder.createFromString( joinLines("search test {", " document test {", " field pos_array type array<position> {", @@ -109,7 +109,7 @@ public class AttributeListTestCase extends SchemaTestCase { " }", " }", "}")).getSearch(); - Iterator<Attribute> attributes = new AttributeFields(search).attributeIterator(); + Iterator<Attribute> attributes = new AttributeFields(schema).attributeIterator(); assertAttribute("pos_array_zcurve", Attribute.Type.LONG, Attribute.CollectionType.ARRAY, true, attributes.next()); assertFalse(attributes.hasNext()); @@ -117,8 +117,8 @@ public class AttributeListTestCase extends SchemaTestCase { @Test public void fields_in_map_of_primitive_are_derived_into_array_attributes() throws IOException, ParseException { - Search search = SearchBuilder.buildFromFile("src/test/derived/map_attribute/test.sd"); - Iterator<Attribute> attributes = new AttributeFields(search).attributeIterator(); + Schema schema = SearchBuilder.buildFromFile("src/test/derived/map_attribute/test.sd"); + Iterator<Attribute> attributes = new AttributeFields(schema).attributeIterator(); assertAttribute("str_map.key", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, true, attributes.next()); assertAttribute("str_map.value", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, false, attributes.next()); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/CasingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/CasingTestCase.java index 554a78c36ef..ad4ca1ebb46 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/CasingTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/CasingTestCase.java @@ -1,7 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchdefinition.derived; -import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.SearchBuilder; import com.yahoo.searchdefinition.SchemaTestCase; import com.yahoo.searchdefinition.parser.ParseException; @@ -20,17 +20,17 @@ public class CasingTestCase extends SchemaTestCase { @Test public void testCasing() throws IOException, ParseException { - Search search = SearchBuilder.buildFromFile("src/test/examples/casing.sd"); - assertEquals(search.getIndex("color").getName(), "color"); - assertEquals(search.getIndex("Foo").getName(), "Foo"); - assertEquals(search.getIndex("Price").getName(), "Price"); - assertEquals(search.getAttribute("artist").getName(), "artist"); - assertEquals(search.getAttribute("Drummer").getName(), "Drummer"); - assertEquals(search.getAttribute("guitarist").getName(), "guitarist"); - assertEquals(search.getAttribute("title").getName(), "title"); - assertEquals(search.getAttribute("Trumpetist").getName(), "Trumpetist"); - assertEquals(search.getAttribute("Saxophonist").getName(), "Saxophonist"); - assertEquals(search.getAttribute("TenorSaxophonist").getName(), "TenorSaxophonist"); - assertEquals(search.getAttribute("Flutist").getName(), "Flutist"); + Schema schema = SearchBuilder.buildFromFile("src/test/examples/casing.sd"); + assertEquals(schema.getIndex("color").getName(), "color"); + assertEquals(schema.getIndex("Foo").getName(), "Foo"); + assertEquals(schema.getIndex("Price").getName(), "Price"); + assertEquals(schema.getAttribute("artist").getName(), "artist"); + assertEquals(schema.getAttribute("Drummer").getName(), "Drummer"); + assertEquals(schema.getAttribute("guitarist").getName(), "guitarist"); + assertEquals(schema.getAttribute("title").getName(), "title"); + assertEquals(schema.getAttribute("Trumpetist").getName(), "Trumpetist"); + assertEquals(schema.getAttribute("Saxophonist").getName(), "Saxophonist"); + assertEquals(schema.getAttribute("TenorSaxophonist").getName(), "TenorSaxophonist"); + assertEquals(schema.getAttribute("Flutist").getName(), "Flutist"); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/CombinedAttributeAndIndexSearchTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/CombinedAttributeAndIndexSchemaTestCase.java index dcf6a84fd2e..bb339688fcb 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/CombinedAttributeAndIndexSearchTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/CombinedAttributeAndIndexSchemaTestCase.java @@ -11,7 +11,7 @@ import java.io.IOException; * * @author bratseth */ -public class CombinedAttributeAndIndexSearchTestCase extends AbstractExportingTestCase { +public class CombinedAttributeAndIndexSchemaTestCase extends AbstractExportingTestCase { @Test public void testMultipleSummaries() throws IOException, ParseException { diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/EmptyRankProfileTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/EmptyRankProfileTestCase.java index 8778a177b81..41ad7cd3bd1 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/EmptyRankProfileTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/EmptyRankProfileTestCase.java @@ -4,7 +4,7 @@ package com.yahoo.searchdefinition.derived; import com.yahoo.document.DataType; import com.yahoo.search.query.profile.QueryProfileRegistry; import com.yahoo.searchdefinition.RankProfileRegistry; -import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.SearchBuilder; import com.yahoo.searchdefinition.SchemaTestCase; import com.yahoo.searchdefinition.document.SDDocumentType; @@ -20,18 +20,18 @@ public class EmptyRankProfileTestCase extends SchemaTestCase { @Test public void testDeriving() { - Search search = new Search("test"); - RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(search); + Schema schema = new Schema("test"); + RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); SDDocumentType doc = new SDDocumentType("test"); - search.addDocument(doc); + schema.addDocument(doc); doc.addField(new SDField("a", DataType.STRING)); SDField field = new SDField("b", DataType.STRING); field.setLiteralBoost(500); doc.addField(field); doc.addField(new SDField("c", DataType.STRING)); - search = SearchBuilder.buildFromRawSearch(search, rankProfileRegistry, new QueryProfileRegistry()); - new DerivedConfiguration(search, rankProfileRegistry); + schema = SearchBuilder.buildFromRawSearch(schema, rankProfileRegistry, new QueryProfileRegistry()); + new DerivedConfiguration(schema, rankProfileRegistry); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/IdTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/IdTestCase.java index 1c63b8c462e..398a13209dd 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/IdTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/IdTestCase.java @@ -4,7 +4,7 @@ package com.yahoo.searchdefinition.derived; import com.yahoo.config.model.application.provider.BaseDeployLogger; import com.yahoo.document.DataType; import com.yahoo.searchdefinition.RankProfileRegistry; -import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.document.SDDocumentType; import com.yahoo.searchdefinition.document.SDField; import com.yahoo.searchdefinition.processing.Processing; @@ -23,14 +23,14 @@ public class IdTestCase extends AbstractExportingTestCase { @Test public void testExplicitUpperCaseIdField() { - Search search = new Search("test"); + Schema schema = new Schema("test"); SDDocumentType document = new SDDocumentType("test"); - search.addDocument(document); + schema.addDocument(document); SDField uri = new SDField("URI", DataType.URI); uri.parseIndexingScript("{ summary | index }"); document.addField(uri); - new Processing().process(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(), true, false); + new Processing().process(schema, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(), true, false); assertNull(document.getField("uri")); assertNull(document.getField("Uri")); 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 a07eb1015a1..59950cee638 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 @@ -4,7 +4,7 @@ package com.yahoo.searchdefinition.derived; import com.yahoo.document.DataType; import com.yahoo.document.config.DocumentmanagerConfig; import com.yahoo.searchdefinition.Index; -import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.SearchBuilder; import com.yahoo.searchdefinition.document.SDDocumentType; import com.yahoo.searchdefinition.document.SDField; @@ -143,20 +143,20 @@ public class InheritanceTestCase extends AbstractExportingTestCase { @Test public void testIndexSettingInheritance() { SDDocumentType parent = new SDDocumentType("parent"); - Search parentSearch = new Search("parent"); - parentSearch.addDocument(parent); + Schema parentSchema = new Schema("parent"); + parentSchema.addDocument(parent); SDField prefixed = parent.addField("prefixed", DataType.STRING); prefixed.parseIndexingScript("{ index }"); prefixed.addIndex(new Index("prefixed", true)); SDDocumentType child = new SDDocumentType("child"); child.inherit(parent); - Search childSearch = new Search("child"); - childSearch.addDocument(child); + Schema childSchema = new Schema("child"); + childSchema.addDocument(child); prefixed = (SDField)child.getField("prefixed"); assertNotNull(prefixed); - assertEquals(new Index("prefixed", true), childSearch.getIndex("prefixed")); + assertEquals(new Index("prefixed", true), childSchema.getIndex("prefixed")); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/LiteralBoostTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/LiteralBoostTestCase.java index 070d7ff5337..b12ca6d1c62 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/LiteralBoostTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/LiteralBoostTestCase.java @@ -6,7 +6,7 @@ import com.yahoo.document.DataType; import com.yahoo.search.query.profile.QueryProfileRegistry; import com.yahoo.searchdefinition.RankProfile; import com.yahoo.searchdefinition.RankProfileRegistry; -import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.SearchBuilder; import com.yahoo.searchdefinition.document.SDDocumentType; import com.yahoo.searchdefinition.document.SDField; @@ -29,19 +29,19 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase { */ @Test public void testLiteralBoost() { - Search search=new Search("literalboost"); - RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(search); + Schema schema =new Schema("literalboost"); + RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); SDDocumentType document=new SDDocumentType("literalboost"); - search.addDocument(document); + schema.addDocument(document); SDField field1= document.addField("a", DataType.STRING); field1.parseIndexingScript("{ index }"); field1.setLiteralBoost(20); - RankProfile other=new RankProfile("other", search, rankProfileRegistry, search.rankingConstants()); + RankProfile other=new RankProfile("other", schema, rankProfileRegistry, schema.rankingConstants()); rankProfileRegistry.add(other); other.addRankSetting(new RankProfile.RankSetting("a", RankProfile.RankSetting.Type.LITERALBOOST, 333)); - new Processing().process(search, new BaseDeployLogger(), rankProfileRegistry, new QueryProfiles(), true, false); - DerivedConfiguration derived=new DerivedConfiguration(search, rankProfileRegistry); + new Processing().process(schema, new BaseDeployLogger(), rankProfileRegistry, new QueryProfiles(), true, false); + DerivedConfiguration derived=new DerivedConfiguration(schema, rankProfileRegistry); // Check attribute fields derived.getAttributeFields(); // TODO: assert content @@ -49,7 +49,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase { // Check il script addition assertIndexing(Arrays.asList("clear_state | guard { input a | tokenize normalize stem:\"BEST\" | index a; }", "clear_state | guard { input a | tokenize | index a_literal; }"), - search); + schema); // Check index info addition IndexInfo indexInfo=derived.getIndexInfo(); @@ -61,23 +61,23 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase { */ @Test public void testNonDefaultRankLiteralBoost() { - Search search=new Search("literalboost"); - RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(search); + Schema schema =new Schema("literalboost"); + RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); SDDocumentType document=new SDDocumentType("literalboost"); - search.addDocument(document); + schema.addDocument(document); SDField field1= document.addField("a", DataType.STRING); field1.parseIndexingScript("{ index }"); - RankProfile other=new RankProfile("other", search, rankProfileRegistry, search.rankingConstants()); + RankProfile other=new RankProfile("other", schema, rankProfileRegistry, schema.rankingConstants()); rankProfileRegistry.add(other); other.addRankSetting(new RankProfile.RankSetting("a", RankProfile.RankSetting.Type.LITERALBOOST, 333)); - search = SearchBuilder.buildFromRawSearch(search, rankProfileRegistry, new QueryProfileRegistry()); - DerivedConfiguration derived = new DerivedConfiguration(search, rankProfileRegistry); + schema = SearchBuilder.buildFromRawSearch(schema, rankProfileRegistry, new QueryProfileRegistry()); + DerivedConfiguration derived = new DerivedConfiguration(schema, rankProfileRegistry); // Check il script addition assertIndexing(Arrays.asList("clear_state | guard { input a | tokenize normalize stem:\"BEST\" | index a; }", "clear_state | guard { input a | tokenize | index a_literal; }"), - search); + schema); // Check index info addition IndexInfo indexInfo=derived.getIndexInfo(); @@ -87,10 +87,10 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase { /** Tests literal boosts in two fields going to the same index */ @Test public void testTwoLiteralBoostFields() { - Search search=new Search("msb"); - RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(search); + Schema schema =new Schema("msb"); + RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); SDDocumentType document=new SDDocumentType("msb"); - search.addDocument(document); + schema.addDocument(document); SDField field1= document.addField("title", DataType.STRING); field1.parseIndexingScript("{ summary | index }"); field1.setLiteralBoost(20); @@ -98,13 +98,13 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase { field2.parseIndexingScript("{ summary | index }"); field2.setLiteralBoost(20); - search = SearchBuilder.buildFromRawSearch(search, rankProfileRegistry, new QueryProfileRegistry()); - new DerivedConfiguration(search, rankProfileRegistry); + schema = SearchBuilder.buildFromRawSearch(schema, rankProfileRegistry, new QueryProfileRegistry()); + new DerivedConfiguration(schema, rankProfileRegistry); assertIndexing(Arrays.asList("clear_state | guard { input title | tokenize normalize stem:\"BEST\" | summary title | index title; }", "clear_state | guard { input body | tokenize normalize stem:\"BEST\" | summary body | index body; }", "clear_state | guard { input title | tokenize | index title_literal; }", "clear_state | guard { input body | tokenize | index body_literal; }"), - search); + schema); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SearchOrdererTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaOrdererTestCase.java index 00fc07de221..ef939aa5093 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SearchOrdererTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaOrdererTestCase.java @@ -5,7 +5,7 @@ import com.yahoo.document.ReferenceDataType; import com.yahoo.document.TemporaryStructuredDataType; import com.yahoo.searchdefinition.DocumentReference; import com.yahoo.searchdefinition.DocumentReferences; -import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.SchemaTestCase; import com.yahoo.searchdefinition.document.SDDocumentType; import com.yahoo.searchdefinition.document.SDField; @@ -26,33 +26,33 @@ import static org.junit.Assert.assertEquals; * @author bratseth * @author bjorncs */ -public class SearchOrdererTestCase extends SchemaTestCase { +public class SchemaOrdererTestCase extends SchemaTestCase { - private static Map<String, Search> createSchemas() { - Map<String, Search> schemas = new HashMap<>(); + private static Map<String, Schema> createSchemas() { + Map<String, Schema> schemas = new HashMap<>(); - Search grandParent = createSchema("grandParent", schemas); + Schema grandParent = createSchema("grandParent", schemas); - Search mother = createSchema("mother", schemas); + Schema mother = createSchema("mother", schemas); inherit(mother, grandParent); - Search father = createSchema("father", schemas); + Schema father = createSchema("father", schemas); inherit(father, grandParent); createDocumentReference(father, mother, "wife_ref"); - Search daugther = createSchema("daughter", schemas); + Schema daugther = createSchema("daughter", schemas); inherit(daugther, father); inherit(daugther, mother); - Search son = createSchema("son", schemas); + Schema son = createSchema("son", schemas); inherit(son, father); inherit(son, mother); - Search product = createSchema("product", schemas); + Schema product = createSchema("product", schemas); - Search pc = createSchema("pc", schemas); + Schema pc = createSchema("pc", schemas); inherit(pc, product); - Search pcAccessory = createSchema("accessory-pc", schemas); + Schema pcAccessory = createSchema("accessory-pc", schemas); inherit(pcAccessory, product); createDocumentReference(pcAccessory, pc, "pc_ref"); @@ -61,34 +61,34 @@ public class SearchOrdererTestCase extends SchemaTestCase { return schemas; } - private static Search createSchema(String name, Map<String, Search> schemas) { - Search search = new Search(name); + private static Schema createSchema(String name, Map<String, Schema> schemas) { + Schema schema = new Schema(name); SDDocumentType document = new SDDocumentType(name); document.setDocumentReferences(new DocumentReferences(emptyMap())); - search.addDocument(document); - schemas.put(search.getName(), search); - return search; + schema.addDocument(document); + schemas.put(schema.getName(), schema); + return schema; } - private static void inherit(Search inheritee, Search inherited) { + private static void inherit(Schema inheritee, Schema inherited) { inheritee.getDocument().inherit(inherited.getDocument()); } private static void assertOrder(List<String> expectedSearchOrder, List<String> inputNames) { - Map<String, Search> schemas = createSchemas(); - List<Search> inputSchemas = inputNames.stream() - .map(schemas::get) - .map(Objects::requireNonNull) - .collect(toList()); + Map<String, Schema> schemas = createSchemas(); + List<Schema> inputSchemas = inputNames.stream() + .map(schemas::get) + .map(Objects::requireNonNull) + .collect(toList()); List<String> actualSearchOrder = new SearchOrderer() .order(inputSchemas) .stream() - .map(Search::getName) + .map(Schema::getName) .collect(toList()); assertEquals(expectedSearchOrder, actualSearchOrder); } - private static void createDocumentReference(Search from, Search to, String refFieldName) { + private static void createDocumentReference(Schema from, Schema to, String refFieldName) { SDField refField = new TemporarySDField(refFieldName, ReferenceDataType.createWithInferredId(TemporaryStructuredDataType.create(to.getName()))); SDDocumentType fromDocument = from.getDocument(); fromDocument.addField(refField); 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 08d888aba0b..106f5a54cfe 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 @@ -1,7 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchdefinition.derived; -import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.SearchBuilder; import com.yahoo.searchdefinition.parser.ParseException; import org.junit.Test; @@ -24,14 +24,14 @@ public class SimpleInheritTestCase extends AbstractExportingTestCase { builder.importFile(expectedResultsDirName + "child.sd"); builder.build(); - Search search = builder.getSearch("child"); + Schema schema = builder.getSearch("child"); String toDirName = "temp/" + name; File toDir = new File(toDirName); toDir.mkdirs(); deleteContent(toDir); - DerivedConfiguration config = new DerivedConfiguration(search, builder.getRankProfileRegistry()); + DerivedConfiguration config = new DerivedConfiguration(schema, builder.getRankProfileRegistry()); config.export(toDirName); checkDir(toDirName, expectedResultsDirName); 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 adc8b82f5fe..6ed03f7b237 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 @@ -28,8 +28,8 @@ import static org.junit.Assert.assertTrue; public class SummaryMapTestCase extends SchemaTestCase { @Test public void testDeriving() throws IOException, ParseException { - Search search = SearchBuilder.buildFromFile("src/test/examples/simple.sd"); - SummaryMap summaryMap=new SummaryMap(search); + Schema schema = SearchBuilder.buildFromFile("src/test/examples/simple.sd"); + SummaryMap summaryMap=new SummaryMap(schema); Iterator transforms=summaryMap.resultTransformIterator(); FieldResultTransform transform = (FieldResultTransform)transforms.next(); @@ -72,14 +72,14 @@ public class SummaryMapTestCase extends SchemaTestCase { } @Test public void testPositionDeriving() { - Search search = new Search("store"); + Schema schema = new Schema("store"); SDDocumentType document = new SDDocumentType("store"); - search.addDocument(document); + schema.addDocument(document); String fieldName = "location"; SDField field = document.addField(fieldName, PositionDataType.INSTANCE); field.parseIndexingScript("{ attribute | summary }"); - new Processing().process(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(), true, false); - SummaryMap summaryMap = new SummaryMap(search); + new Processing().process(schema, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(), true, false); + SummaryMap summaryMap = new SummaryMap(schema); Iterator transforms = summaryMap.resultTransformIterator(); @@ -186,7 +186,7 @@ public class SummaryMapTestCase extends SchemaTestCase { assertEquals(expFieldName, override.arguments()); } - private Search buildSearch(String field) throws ParseException { + private Schema buildSearch(String field) throws ParseException { var builder = new SearchBuilder(new RankProfileRegistry()); builder.importString(joinLines("search test {", " document test {", 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 e92f81052de..67403cdd25a 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 @@ -2,7 +2,7 @@ package com.yahoo.searchdefinition.derived; import com.yahoo.config.model.application.provider.BaseDeployLogger; -import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.SearchBuilder; import com.yahoo.searchdefinition.SchemaTestCase; import com.yahoo.searchdefinition.parser.ParseException; @@ -35,8 +35,8 @@ public class SummaryTestCase extends SchemaTestCase { " }", " }", "}"); - Search search = SearchBuilder.createFromString(sd).getSearch(); - SummaryClass summary = new SummaryClass(search, search.getSummary("default"), new BaseDeployLogger()); + Schema schema = SearchBuilder.createFromString(sd).getSearch(); + SummaryClass summary = new SummaryClass(schema, schema.getSummary("default"), new BaseDeployLogger()); assertEquals(SummaryClassField.Type.RAW, summary.getField("raw_field").getType()); } @@ -50,15 +50,15 @@ public class SummaryTestCase extends SchemaTestCase { " }", " }", "}"); - Search search = SearchBuilder.createFromString(sd).getSearch(); - SummaryClass summary = new SummaryClass(search, search.getSummary("default"), new BaseDeployLogger()); + Schema schema = SearchBuilder.createFromString(sd).getSearch(); + SummaryClass summary = new SummaryClass(schema, schema.getSummary("default"), new BaseDeployLogger()); assertEquals(SummaryClassField.Type.DATA, summary.getField("raw_field").getType()); } @Test public void testDeriving() throws IOException, ParseException { - Search search = SearchBuilder.buildFromFile("src/test/examples/simple.sd"); - SummaryClass summary = new SummaryClass(search, search.getSummary("default"), new BaseDeployLogger()); + Schema schema = SearchBuilder.buildFromFile("src/test/examples/simple.sd"); + SummaryClass summary = new SummaryClass(schema, schema.getSummary("default"), new BaseDeployLogger()); assertEquals("default", summary.getName()); Iterator<SummaryClassField> fields = summary.fieldIterator(); @@ -122,18 +122,18 @@ public class SummaryTestCase extends SchemaTestCase { @Test public void reference_fields_can_be_part_of_summary_classes() throws ParseException { - Search adSearch = buildCampaignAdModel(); + Schema adSchema = buildCampaignAdModel(); - SummaryClass defaultClass = new SummaryClass(adSearch, adSearch.getSummary("default"), new BaseDeployLogger()); + SummaryClass defaultClass = new SummaryClass(adSchema, adSchema.getSummary("default"), new BaseDeployLogger()); assertEquals(SummaryClassField.Type.LONGSTRING, defaultClass.getField("campaign_ref").getType()); assertEquals(SummaryClassField.Type.LONGSTRING, defaultClass.getField("other_campaign_ref").getType()); - SummaryClass myClass = new SummaryClass(adSearch, adSearch.getSummary("my_summary"), new BaseDeployLogger()); + SummaryClass myClass = new SummaryClass(adSchema, adSchema.getSummary("my_summary"), new BaseDeployLogger()); assertNull(myClass.getField("campaign_ref")); assertEquals(SummaryClassField.Type.LONGSTRING, myClass.getField("other_campaign_ref").getType()); } - private static Search buildCampaignAdModel() throws ParseException { + private static Schema buildCampaignAdModel() throws ParseException { SearchBuilder builder = new SearchBuilder(); builder.importString("search campaign { document campaign {} }"); builder.importString(joinLines("search ad {", @@ -173,8 +173,8 @@ public class SummaryTestCase extends SchemaTestCase { assertOmitSummaryFeatures(false, search, "baz"); } - private void assertOmitSummaryFeatures(boolean expected, Search search, String summaryName) { - var summary = new SummaryClass(search, search.getSummary(summaryName), new BaseDeployLogger()); + private void assertOmitSummaryFeatures(boolean expected, Schema schema, String summaryName) { + var summary = new SummaryClass(schema, schema.getSummary(summaryName), new BaseDeployLogger()); var config = new SummaryConfig.Classes(summary.getSummaryClassConfig()); assertEquals(expected, config.omitsummaryfeatures()); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/TypeConversionTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/TypeConversionTestCase.java index 2b65361e922..bfed1efe398 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/TypeConversionTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/TypeConversionTestCase.java @@ -4,7 +4,7 @@ package com.yahoo.searchdefinition.derived; import com.yahoo.config.model.application.provider.BaseDeployLogger; import com.yahoo.document.DataType; import com.yahoo.searchdefinition.RankProfileRegistry; -import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.SchemaTestCase; import com.yahoo.searchdefinition.document.SDDocumentType; import com.yahoo.searchdefinition.document.SDField; @@ -23,16 +23,16 @@ public class TypeConversionTestCase extends SchemaTestCase { /** Tests that exact-string stuff is not spilled over to the default index */ @Test public void testExactStringToStringTypeConversion() { - Search search = new Search("test"); - RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(search); + Schema schema = new Schema("test"); + RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); SDDocumentType document = new SDDocumentType("test"); - search.addDocument(document); + schema.addDocument(document); SDField a = new SDField("a", DataType.STRING); a.parseIndexingScript("{ index }"); document.addField(a); - new Processing().process(search, new BaseDeployLogger(), rankProfileRegistry, new QueryProfiles(), true, false); - DerivedConfiguration derived = new DerivedConfiguration(search, rankProfileRegistry); + new Processing().process(schema, new BaseDeployLogger(), rankProfileRegistry, new QueryProfiles(), true, false); + DerivedConfiguration derived = new DerivedConfiguration(schema, rankProfileRegistry); IndexInfo indexInfo = derived.getIndexInfo(); assertFalse(indexInfo.hasCommand("default", "compact-to-term")); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java index 3e3904fa250..55702c9e1a7 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java @@ -7,7 +7,7 @@ import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.document.ReferenceDataType; import com.yahoo.document.TemporaryStructuredDataType; import com.yahoo.searchdefinition.Application; -import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.document.SDDocumentType; import com.yahoo.searchdefinition.document.SDField; import com.yahoo.searchdefinition.document.TemporarySDField; @@ -23,13 +23,13 @@ public class VsmFieldsTestCase { @Test public void reference_type_field_is_unsearchable() { - Search search = new Search("test", new Application(MockApplicationPackage.createEmpty()), new MockFileRegistry(), new TestableDeployLogger(), new TestProperties()); - search.addDocument(new SDDocumentType("test")); + Schema schema = new Schema("test", new Application(MockApplicationPackage.createEmpty()), new MockFileRegistry(), new TestableDeployLogger(), new TestProperties()); + schema.addDocument(new SDDocumentType("test")); SDField refField = new TemporarySDField("ref_field", ReferenceDataType.createWithInferredId(TemporaryStructuredDataType.create("parent_type"))); refField.parseIndexingScript("{ summary }"); - search.getDocument().addField(refField); + schema.getDocument().addField(refField); - VsmFields vsmFields = new VsmFields(search); + VsmFields vsmFields = new VsmFields(schema); VsmfieldsConfig.Builder cfgBuilder = new VsmfieldsConfig.Builder(); vsmFields.getConfig(cfgBuilder); VsmfieldsConfig cfg = cfgBuilder.build(); |