summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-03-29 17:27:23 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2023-03-29 17:40:25 +0200
commitbfc460a89a117706dc54342707abb45a5f18252e (patch)
tree4c01b12db75059928b4ccaff921adc849b2fee74 /container-search
parent090518630dc1e8cec760ae9d831d562fa02b5388 (diff)
- Use CompoundName.from
- Deprecate unused SubProperties
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/grouping/result/FlatteningSearcher.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/grouping/vespa/GroupingExecutor.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/compiled/CompiledQueryProfile.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java8
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/properties/SubProperties.java4
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/ranking/SoftTimeout.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/properties/SubPropertiesTestCase.java (renamed from container-search/src/test/java/com/yahoo/search/query/properties/test/SubPropertiesTestCase.java)5
9 files changed, 15 insertions, 15 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java b/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java
index 09db1be4732..4e4b77422c1 100644
--- a/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java
+++ b/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java
@@ -52,7 +52,7 @@ public class Dispatcher extends AbstractComponent {
private static final int MAX_GROUP_SELECTION_ATTEMPTS = 3;
/** If set will control computation of how many hits will be fetched from each partition.*/
- public static final CompoundName topKProbability = CompoundName.fromComponents(DISPATCH, TOP_K_PROBABILITY);
+ public static final CompoundName topKProbability = CompoundName.from(DISPATCH + "." + TOP_K_PROBABILITY);
private final DispatchConfig dispatchConfig;
private final RpcResourcePool rpcResourcePool;
diff --git a/container-search/src/main/java/com/yahoo/search/grouping/result/FlatteningSearcher.java b/container-search/src/main/java/com/yahoo/search/grouping/result/FlatteningSearcher.java
index e56b88c3d3e..027ba92f587 100644
--- a/container-search/src/main/java/com/yahoo/search/grouping/result/FlatteningSearcher.java
+++ b/container-search/src/main/java/com/yahoo/search/grouping/result/FlatteningSearcher.java
@@ -22,7 +22,7 @@ import java.util.Iterator;
@Before(GroupingExecutor.COMPONENT_NAME)
public class FlatteningSearcher extends Searcher {
- private final CompoundName flatten = CompoundName.fromComponents("grouping", "flatten");
+ private final CompoundName flatten = CompoundName.from("grouping.flatten");
@Override
public Result search(Query query, Execution execution) {
diff --git a/container-search/src/main/java/com/yahoo/search/grouping/vespa/GroupingExecutor.java b/container-search/src/main/java/com/yahoo/search/grouping/vespa/GroupingExecutor.java
index 2ba33f60ea1..c85dbed83c8 100644
--- a/container-search/src/main/java/com/yahoo/search/grouping/vespa/GroupingExecutor.java
+++ b/container-search/src/main/java/com/yahoo/search/grouping/vespa/GroupingExecutor.java
@@ -379,7 +379,7 @@ public class GroupingExecutor extends Searcher {
}
private static CompoundName newCompoundName(String name) {
- return new CompoundName(GroupingExecutor.class.getName() + "." + name);
+ return CompoundName.from(GroupingExecutor.class.getName() + "." + name);
}
private static class RequestContext {
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/compiled/CompiledQueryProfile.java b/container-search/src/main/java/com/yahoo/search/query/profile/compiled/CompiledQueryProfile.java
index ad9d3f4c1a5..ae531c67dd1 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/compiled/CompiledQueryProfile.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/compiled/CompiledQueryProfile.java
@@ -169,7 +169,7 @@ public class CompiledQueryProfile extends AbstractComponent implements Cloneable
}
public final Object get(String name) {
- return get(name, Collections.emptyMap());
+ return get(name, Map.of());
}
public final Object get(String name, Map<String, String> context) {
return get(name, context, new QueryProfileProperties(this));
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java
index 8fdbf8b2281..719a5a2c281 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java
@@ -64,7 +64,7 @@ public class FieldDescription implements Comparable<FieldDescription> {
}
public FieldDescription(String name, FieldType type, String aliases, boolean mandatory, boolean overridable) {
- this(new CompoundName(name), type, aliases, mandatory, overridable);
+ this(CompoundName.from(name), type, aliases, mandatory, overridable);
}
/**
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java
index 3da2ad53f9a..9cbfe5b7112 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java
@@ -52,7 +52,7 @@ public class QueryProfileType extends FreezableSimpleComponent {
private QueryProfileType(ComponentId id, Map<String, FieldDescription> fields, List<QueryProfileType> inherited) {
super(id);
QueryProfile.validateName(id.getName());
- componentIdAsCompoundName = new CompoundName(getId().getName());
+ componentIdAsCompoundName = CompoundName.from(getId().getName());
this.fields = fields;
this.inherited = inherited;
}
@@ -318,10 +318,9 @@ public class QueryProfileType extends FreezableSimpleComponent {
QueryProfileType type = null;
FieldDescription fieldDescription = getField(name);
if (fieldDescription != null) {
- if ( ! (fieldDescription.getType() instanceof QueryProfileFieldType))
+ if ( ! (fieldDescription.getType() instanceof QueryProfileFieldType fieldType))
throw new IllegalArgumentException("Cannot use name '" + name + "' as a prefix because it is " +
"already a " + fieldDescription.getType());
- QueryProfileFieldType fieldType = (QueryProfileFieldType) fieldDescription.getType();
type = fieldType.getQueryProfileType();
}
@@ -399,8 +398,7 @@ public class QueryProfileType extends FreezableSimpleComponent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
- if ( ! (o instanceof QueryProfileType)) return false;
- QueryProfileType other = (QueryProfileType)o;
+ if ( ! (o instanceof QueryProfileType other)) return false;
return other.getId().equals(this.getId());
}
diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/SubProperties.java b/container-search/src/main/java/com/yahoo/search/query/properties/SubProperties.java
index 42fb4e44040..4fc9dfa03cd 100644
--- a/container-search/src/main/java/com/yahoo/search/query/properties/SubProperties.java
+++ b/container-search/src/main/java/com/yahoo/search/query/properties/SubProperties.java
@@ -10,14 +10,16 @@ import java.util.Map;
* A wrapper around a chain of property objects that prefixes all gets/sets with a given path
*
* @author Arne Bergene Fossaa
+ * @deprecated Unused and will go away on vespa 9
*/
+@Deprecated (forRemoval = true)
public class SubProperties extends com.yahoo.search.query.Properties {
final private CompoundName pathPrefix;
final private Properties parent;
public SubProperties(String pathPrefix, Properties properties) {
- this(new CompoundName(pathPrefix),properties);
+ this(CompoundName.from(pathPrefix), properties);
}
public SubProperties(CompoundName pathPrefix, Properties properties) {
diff --git a/container-search/src/main/java/com/yahoo/search/query/ranking/SoftTimeout.java b/container-search/src/main/java/com/yahoo/search/query/ranking/SoftTimeout.java
index 30ee2f473b7..c49b14f0978 100644
--- a/container-search/src/main/java/com/yahoo/search/query/ranking/SoftTimeout.java
+++ b/container-search/src/main/java/com/yahoo/search/query/ranking/SoftTimeout.java
@@ -24,8 +24,7 @@ public class SoftTimeout implements Cloneable {
public static final String TAILCOST = "tailcost";
/** The full property name for turning softtimeout on or off */
- public static final CompoundName enableProperty =
- CompoundName.fromComponents(Ranking.RANKING, Ranking.SOFTTIMEOUT, ENABLE);
+ public static final CompoundName enableProperty = CompoundName.from(Ranking.RANKING + "." + Ranking.SOFTTIMEOUT + "." + ENABLE);
static {
argumentType = new QueryProfileType(Ranking.SOFTTIMEOUT);
diff --git a/container-search/src/test/java/com/yahoo/search/query/properties/test/SubPropertiesTestCase.java b/container-search/src/test/java/com/yahoo/search/query/properties/SubPropertiesTestCase.java
index 0e9bf8d41ec..6b25dc526d9 100644
--- a/container-search/src/test/java/com/yahoo/search/query/properties/test/SubPropertiesTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/query/properties/SubPropertiesTestCase.java
@@ -1,5 +1,5 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.search.query.properties.test;
+package com.yahoo.search.query.properties;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -9,11 +9,12 @@ import java.util.HashSet;
import com.yahoo.processing.request.properties.PropertyMap;
import org.junit.jupiter.api.Test;
-import com.yahoo.search.query.properties.SubProperties;
/**
* @author <a href="mailto:arnebef@yahoo-inc.com">Arne Bergene Fossaa</a>
*/
+@SuppressWarnings({"removal"})
+
public class SubPropertiesTestCase {
@Test