summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2022-07-07 12:19:09 +0200
committerHarald Musum <musum@yahooinc.com>2022-07-07 12:19:09 +0200
commit2a64c712743594812dbf96ec5ff8d3b7482c4748 (patch)
treeeda8cc27689fb90afb644a12976441642f898012 /container-search
parent6c0b98634aad1e3ea60a5680afb5943391716b12 (diff)
Deprecate ConfigGetter
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/config/QueryProfileConfigurer.java1
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/IndexFactsFactory.java1
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/query/parser/test/ParsingTester.java1
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/searcher/test/ValidateSortingSearcherTestCase.java16
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/semantics/test/ConfigurationTestCase.java7
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java27
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/rewrite/test/QueryRewriteSearcherTestUtils.java1
-rw-r--r--container-search/src/test/java/com/yahoo/search/searchers/ValidateFuzzySearcherTestCase.java34
-rw-r--r--container-search/src/test/java/com/yahoo/search/searchers/ValidateNearestNeighborTestCase.java11
-rw-r--r--container-search/src/test/java/com/yahoo/search/searchers/test/ValidateMatchPhaseSearcherTestCase.java4
10 files changed, 40 insertions, 63 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/config/QueryProfileConfigurer.java b/container-search/src/main/java/com/yahoo/search/query/profile/config/QueryProfileConfigurer.java
index 31278af9579..5b30e3c383d 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/config/QueryProfileConfigurer.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/config/QueryProfileConfigurer.java
@@ -21,6 +21,7 @@ import java.util.Set;
*/
public class QueryProfileConfigurer {
+ @SuppressWarnings("deprecation")
public static QueryProfileRegistry createFromConfigId(String configId) {
return createFromConfig(ConfigGetter.getConfig(QueryProfilesConfig.class, configId));
}
diff --git a/container-search/src/test/java/com/yahoo/prelude/IndexFactsFactory.java b/container-search/src/test/java/com/yahoo/prelude/IndexFactsFactory.java
index 88cc066b665..482c9e3c6ba 100644
--- a/container-search/src/test/java/com/yahoo/prelude/IndexFactsFactory.java
+++ b/container-search/src/test/java/com/yahoo/prelude/IndexFactsFactory.java
@@ -23,6 +23,7 @@ public abstract class IndexFactsFactory {
}
+ @SuppressWarnings("deprecation")
private static <T extends ConfigInstance> T resolveConfig(Class<T> configClass, String configId) {
if (configId == null) return null;
return ConfigGetter.getConfig(configClass, configId);
diff --git a/container-search/src/test/java/com/yahoo/prelude/query/parser/test/ParsingTester.java b/container-search/src/test/java/com/yahoo/prelude/query/parser/test/ParsingTester.java
index 229416f7a85..42bc1c22529 100644
--- a/container-search/src/test/java/com/yahoo/prelude/query/parser/test/ParsingTester.java
+++ b/container-search/src/test/java/com/yahoo/prelude/query/parser/test/ParsingTester.java
@@ -62,6 +62,7 @@ public class ParsingTester {
* Returns an unfrozen version of the IndexFacts this will use.
* This can be used to add new indexes and passing the resulting IndexFacts to the constructor of this.
*/
+ @SuppressWarnings("deprecation")
public static IndexFacts createIndexFacts() {
String indexInfoConfigID = "file:src/test/java/com/yahoo/prelude/query/parser/test/parseindexinfo.cfg";
ConfigGetter<IndexInfoConfig> getter = new ConfigGetter<>(IndexInfoConfig.class);
diff --git a/container-search/src/test/java/com/yahoo/prelude/searcher/test/ValidateSortingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/searcher/test/ValidateSortingSearcherTestCase.java
index 84b8ef32871..6b8c268f4ca 100644
--- a/container-search/src/test/java/com/yahoo/prelude/searcher/test/ValidateSortingSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/searcher/test/ValidateSortingSearcherTestCase.java
@@ -2,24 +2,23 @@
package com.yahoo.prelude.searcher.test;
import com.yahoo.component.chain.Chain;
-import com.yahoo.language.simple.SimpleLinguistics;
-import com.yahoo.search.Searcher;
-import com.yahoo.search.rendering.RendererRegistry;
-import com.yahoo.search.searchchain.Execution;
-import com.yahoo.vespa.config.search.AttributesConfig;
-import com.yahoo.search.config.ClusterConfig;
import com.yahoo.config.subscription.ConfigGetter;
import com.yahoo.container.QrSearchersConfig;
import com.yahoo.prelude.searcher.ValidateSortingSearcher;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
+import com.yahoo.search.Searcher;
+import com.yahoo.search.config.ClusterConfig;
+import com.yahoo.search.searchchain.Execution;
import com.yahoo.search.test.QueryTestCase;
+import com.yahoo.vespa.config.search.AttributesConfig;
import org.junit.Test;
-
import java.util.ArrayList;
import java.util.List;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
/**
* Check sorting validation behaves OK.
@@ -30,6 +29,7 @@ public class ValidateSortingSearcherTestCase {
private final ValidateSortingSearcher searcher;
+ @SuppressWarnings("deprecation")
public ValidateSortingSearcherTestCase() {
QrSearchersConfig.Builder qrsCfg = new QrSearchersConfig.Builder();
qrsCfg.searchcluster(new QrSearchersConfig.Searchcluster.Builder().name("giraffes"));
diff --git a/container-search/src/test/java/com/yahoo/prelude/semantics/test/ConfigurationTestCase.java b/container-search/src/test/java/com/yahoo/prelude/semantics/test/ConfigurationTestCase.java
index 0515417f515..7d9ea07339f 100644
--- a/container-search/src/test/java/com/yahoo/prelude/semantics/test/ConfigurationTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/semantics/test/ConfigurationTestCase.java
@@ -4,18 +4,16 @@ package com.yahoo.prelude.semantics.test;
import com.yahoo.component.chain.Chain;
import com.yahoo.config.subscription.ConfigGetter;
import com.yahoo.language.simple.SimpleLinguistics;
-import com.yahoo.prelude.semantics.SemanticRulesConfig;
-import com.yahoo.search.Query;
import com.yahoo.prelude.semantics.RuleBase;
import com.yahoo.prelude.semantics.RuleBaseException;
+import com.yahoo.prelude.semantics.SemanticRulesConfig;
import com.yahoo.prelude.semantics.SemanticSearcher;
+import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.Searcher;
-import com.yahoo.search.rendering.RendererRegistry;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.search.test.QueryTestCase;
import org.junit.Test;
-
import java.util.ArrayList;
import java.util.List;
@@ -28,6 +26,7 @@ import static org.junit.Assert.fail;
*
* @author bratseth
*/
+@SuppressWarnings("deprecation")
public class ConfigurationTestCase {
private static final String root="src/test/java/com/yahoo/prelude/semantics/test/rulebases/";
diff --git a/container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java b/container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java
index 0f7c9526533..6a54492f5e5 100644
--- a/container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java
@@ -1,39 +1,29 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.test;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
import com.google.common.collect.ImmutableList;
import com.yahoo.config.subscription.ConfigGetter;
-import com.yahoo.container.QrSearchersConfig;
-import com.yahoo.search.config.IndexInfoConfig;
-import com.yahoo.search.config.IndexInfoConfig.Indexinfo;
-import com.yahoo.search.config.IndexInfoConfig.Indexinfo.Alias;
-import com.yahoo.search.config.IndexInfoConfig.Indexinfo.Command;
import com.yahoo.language.process.StemMode;
import com.yahoo.prelude.Index;
import com.yahoo.prelude.IndexFacts;
import com.yahoo.prelude.IndexModel;
import com.yahoo.prelude.SearchDefinition;
import com.yahoo.search.Query;
+import com.yahoo.search.config.IndexInfoConfig;
import com.yahoo.search.searchchain.Execution;
import org.junit.Test;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
/**
* Tests using synthetic index names for IndexFacts class.
@@ -45,6 +35,7 @@ public class IndexFactsTestCase {
private static final String INDEXFACTS_TESTING = "file:src/test/java/com/yahoo/prelude/test/indexfactstesting.cfg";
+ @SuppressWarnings("deprecation")
private IndexFacts createIndexFacts() {
ConfigGetter<IndexInfoConfig> getter = new ConfigGetter<>(IndexInfoConfig.class);
IndexInfoConfig config = getter.getConfig(INDEXFACTS_TESTING);
diff --git a/container-search/src/test/java/com/yahoo/search/query/rewrite/test/QueryRewriteSearcherTestUtils.java b/container-search/src/test/java/com/yahoo/search/query/rewrite/test/QueryRewriteSearcherTestUtils.java
index da005871539..c12a3fb0e14 100644
--- a/container-search/src/test/java/com/yahoo/search/query/rewrite/test/QueryRewriteSearcherTestUtils.java
+++ b/container-search/src/test/java/com/yahoo/search/query/rewrite/test/QueryRewriteSearcherTestUtils.java
@@ -40,6 +40,7 @@ public class QueryRewriteSearcherTestUtils {
*
* @param configPath path for the searcher config
*/
+ @SuppressWarnings("deprecation")
public static RewritesConfig createConfigObj(String configPath) {
return new ConfigGetter<>(RewritesConfig.class).getConfig(configPath);
}
diff --git a/container-search/src/test/java/com/yahoo/search/searchers/ValidateFuzzySearcherTestCase.java b/container-search/src/test/java/com/yahoo/search/searchers/ValidateFuzzySearcherTestCase.java
index 587b40dfd03..577963ef2b3 100644
--- a/container-search/src/test/java/com/yahoo/search/searchers/ValidateFuzzySearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/searchers/ValidateFuzzySearcherTestCase.java
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.searchers;
-import com.yahoo.config.subscription.ConfigGetter;
import com.yahoo.prelude.IndexFacts;
import com.yahoo.prelude.IndexModel;
import com.yahoo.prelude.SearchDefinition;
@@ -13,10 +12,9 @@ import com.yahoo.search.query.parser.ParserEnvironment;
import com.yahoo.search.result.ErrorMessage;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.search.yql.YqlParser;
-import com.yahoo.vespa.config.search.AttributesConfig.Attribute;
import com.yahoo.vespa.config.search.AttributesConfig;
+import com.yahoo.vespa.config.search.AttributesConfig.Attribute;
import org.junit.Test;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -33,35 +31,25 @@ public class ValidateFuzzySearcherTestCase {
List<String> attributes;
public ValidateFuzzySearcherTestCase() {
- int i = 0;
attributes = new ArrayList<>();
- StringBuilder attributeConfig = new StringBuilder();
+ AttributesConfig.Builder configBuilder = new AttributesConfig.Builder();
+ List<AttributesConfig.Attribute.Builder> attributesList = new ArrayList<>();
for (Attribute.Datatype.Enum attr: Attribute.Datatype.Enum.values()) {
for (Attribute.Collectiontype.Enum ctype: Attribute.Collectiontype.Enum.values()) {
+ AttributesConfig.Attribute.Builder attributesBuilder = new AttributesConfig.Attribute.Builder();
String attributeName = attr.name().toLowerCase() + "_" + ctype.name().toLowerCase();
+ attributesBuilder.name(attributeName);
+ attributesBuilder.datatype(attr);
+ attributesBuilder.collectiontype(ctype);
+ attributesList.add(attributesBuilder);
- attributeConfig.append("attribute[" + i + "].name ");
- attributeConfig.append(attributeName);
- attributeConfig.append("\n");
-
- attributeConfig.append("attribute[" + i + "].datatype ");
- attributeConfig.append(attr.name());
- attributeConfig.append("\n");
-
- attributeConfig.append("attribute[" + i + "].collectiontype ");
- attributeConfig.append(ctype.name());
- attributeConfig.append("\n");
-
- i += 1;
attributes.add(attributeName);
}
}
+ configBuilder.attribute(attributesList);
+ AttributesConfig config = configBuilder.build();
- searcher = new ValidateFuzzySearcher(ConfigGetter.getConfig(
- AttributesConfig.class,
- "raw: " +
- "attribute[" + attributes.size() + "]\n" +
- attributeConfig));
+ searcher = new ValidateFuzzySearcher(config);
}
private String makeQuery(String attribute, String query, int maxEditDistance, int prefixLength) {
diff --git a/container-search/src/test/java/com/yahoo/search/searchers/ValidateNearestNeighborTestCase.java b/container-search/src/test/java/com/yahoo/search/searchers/ValidateNearestNeighborTestCase.java
index 9a760bfb0cb..c2f4ee31aa8 100644
--- a/container-search/src/test/java/com/yahoo/search/searchers/ValidateNearestNeighborTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/searchers/ValidateNearestNeighborTestCase.java
@@ -2,28 +2,22 @@
package com.yahoo.search.searchers;
import com.yahoo.config.subscription.ConfigGetter;
-import com.yahoo.config.subscription.FileSource;
-import com.yahoo.config.subscription.RawSource;
import com.yahoo.prelude.IndexFacts;
import com.yahoo.prelude.IndexModel;
import com.yahoo.prelude.SearchDefinition;
import com.yahoo.search.Query;
+import com.yahoo.search.Result;
+import com.yahoo.search.query.QueryTree;
import com.yahoo.search.query.parser.Parsable;
import com.yahoo.search.query.parser.ParserEnvironment;
-import com.yahoo.search.query.QueryTree;
-import com.yahoo.search.Result;
import com.yahoo.search.result.ErrorMessage;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.search.yql.YqlParser;
import com.yahoo.tensor.Tensor;
import com.yahoo.tensor.TensorType;
import com.yahoo.vespa.config.search.AttributesConfig;
-
-import com.yahoo.vespa.config.search.RankProfilesConfig;
import org.junit.Test;
-import java.io.File;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@@ -34,6 +28,7 @@ public class ValidateNearestNeighborTestCase {
ValidateNearestNeighborSearcher searcher;
+ @SuppressWarnings("deprecation")
public ValidateNearestNeighborTestCase() {
searcher = new ValidateNearestNeighborSearcher(
ConfigGetter.getConfig(AttributesConfig.class,
diff --git a/container-search/src/test/java/com/yahoo/search/searchers/test/ValidateMatchPhaseSearcherTestCase.java b/container-search/src/test/java/com/yahoo/search/searchers/test/ValidateMatchPhaseSearcherTestCase.java
index 01e360858c1..1b3689a94b0 100644
--- a/container-search/src/test/java/com/yahoo/search/searchers/test/ValidateMatchPhaseSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/searchers/test/ValidateMatchPhaseSearcherTestCase.java
@@ -3,7 +3,6 @@ package com.yahoo.search.searchers.test;
import com.yahoo.component.chain.Chain;
import com.yahoo.config.subscription.ConfigGetter;
-import com.yahoo.config.subscription.RawSource;
import com.yahoo.search.Searcher;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.search.searchers.ValidateMatchPhaseSearcher;
@@ -15,7 +14,7 @@ import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
/**
* @author baldersheim
@@ -24,6 +23,7 @@ public class ValidateMatchPhaseSearcherTestCase {
private final ValidateMatchPhaseSearcher searcher;
+ @SuppressWarnings("deprecation")
public ValidateMatchPhaseSearcherTestCase() {
searcher = new ValidateMatchPhaseSearcher(
ConfigGetter.getConfig(AttributesConfig.class,