summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/profile/types
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/types')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java4
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileTypeRegistry.java7
2 files changed, 9 insertions, 2 deletions
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 c9fcb854771..8b6470996d5 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
@@ -321,13 +321,13 @@ public class QueryProfileType extends FreezableSimpleComponent {
// found in registry but not already added in *this* type (getField also checks parents): extend it
if (type != null && ! fields.containsKey(name)) {
- type = new QueryProfileType(ComponentId.createAnonymousComponentId(type.getIdString()),
+ type = new QueryProfileType(registry.createAnonymousId(type.getIdString()),
new HashMap<>(),
List.of(type));
}
if (type == null) { // create it
- type = new QueryProfileType(ComponentId.createAnonymousComponentId(name));
+ type = new QueryProfileType(registry.createAnonymousId(name));
}
if (fieldDescription == null) {
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileTypeRegistry.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileTypeRegistry.java
index 58a1ae7ad14..201f246b30c 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileTypeRegistry.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileTypeRegistry.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.profile.types;
+import com.yahoo.component.ComponentId;
import com.yahoo.component.provider.ComponentRegistry;
import com.yahoo.search.Query;
import com.yahoo.search.query.profile.QueryProfileRegistry;
@@ -12,6 +13,8 @@ import com.yahoo.search.query.profile.QueryProfileRegistry;
*/
public class QueryProfileTypeRegistry extends ComponentRegistry<QueryProfileType> {
+ private int nextAnonymousId = 0;
+
private final int nativeProfileCount;
public QueryProfileTypeRegistry() {
@@ -42,4 +45,8 @@ public class QueryProfileTypeRegistry extends ComponentRegistry<QueryProfileType
return registry;
}
+ public ComponentId createAnonymousId(String name) {
+ return ComponentId.newAnonymous(name + "_" + (nextAnonymousId++));
+ }
+
}