From 66a521195313c4bb7bb24616667be426c946327f Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Wed, 29 Mar 2023 09:29:36 +0200 Subject: Stay with from. --- .../main/java/com/yahoo/processing/request/CompoundName.java | 5 ----- container-search/src/main/java/com/yahoo/search/Query.java | 10 +++++----- .../yahoo/search/query/profile/test/QueryProfileTestCase.java | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/container-core/src/main/java/com/yahoo/processing/request/CompoundName.java b/container-core/src/main/java/com/yahoo/processing/request/CompoundName.java index 844f6681bc8..620e46ee9cc 100644 --- a/container-core/src/main/java/com/yahoo/processing/request/CompoundName.java +++ b/container-core/src/main/java/com/yahoo/processing/request/CompoundName.java @@ -302,12 +302,7 @@ public final class CompoundName { return b.length()==0 ? "" : b.substring(0, b.length()-1); } - /** @deprecated Use of() instead */ - @Deprecated public static CompoundName from(String name) { - return of(name); - } - public static CompoundName of(String name) { CompoundName found = cache.get(name); if (found != null) return found; diff --git a/container-search/src/main/java/com/yahoo/search/Query.java b/container-search/src/main/java/com/yahoo/search/Query.java index b0023260f67..39fd372d2a7 100644 --- a/container-search/src/main/java/com/yahoo/search/Query.java +++ b/container-search/src/main/java/com/yahoo/search/Query.java @@ -445,8 +445,8 @@ public class Query extends com.yahoo.processing.Request implements Cloneable { if (field.getType() == FieldType.genericQueryProfileType) { // Generic map String fullName = append(prefix, field.getCompoundName().toString()); - for (Map.Entry entry : originalProperties.listProperties(CompoundName.of(fullName), context).entrySet()) { - properties().set(CompoundName.of(append(fullName, entry.getKey())), entry.getValue(), context); + for (Map.Entry entry : originalProperties.listProperties(CompoundName.from(fullName), context).entrySet()) { + properties().set(CompoundName.from(append(fullName, entry.getKey())), entry.getValue(), context); } } else if (field.getType() instanceof QueryProfileFieldType) { // Nested arguments @@ -455,7 +455,7 @@ public class Query extends com.yahoo.processing.Request implements Cloneable { else { CompoundName fullName = prefix.isEmpty() ? field.getCompoundName() - : CompoundName.of(append(prefix, field.getCompoundName().toString())); + : CompoundName.from(append(prefix, field.getCompoundName().toString())); Object value = originalProperties.get(fullName, context); if (value != null) { properties().set(fullName, value, context); @@ -470,11 +470,11 @@ public class Query extends com.yahoo.processing.Request implements Cloneable { for (var entry : entrySet) { if (ignoreSelect && entry.getKey().equals(Select.SELECT)) continue; if (RankFeatures.isFeatureName(entry.getKey())) continue; // Set these last - properties.set(CompoundName.of(entry.getKey()), entry.getValue(), requestMap); + properties.set(CompoundName.from(entry.getKey()), entry.getValue(), requestMap); } for (var entry : entrySet) { if ( ! RankFeatures.isFeatureName(entry.getKey())) continue; - properties.set(CompoundName.of(entry.getKey()), entry.getValue(), requestMap); + properties.set(CompoundName.from(entry.getKey()), entry.getValue(), requestMap); } } diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java b/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java index 4d3826bbae7..cd4cb32df2e 100644 --- a/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java @@ -663,13 +663,13 @@ public class QueryProfileTestCase { "ne=true", Method.GET); for (int i = 0; i < 30000; i++) { Query q = new Query(httpRequest, cqp); - assertTrue(q.properties().getBoolean(CompoundName.of("clustering.timeline"), false)); + assertTrue(q.properties().getBoolean(CompoundName.from("clustering.timeline"), false)); } Thread.sleep(2000); long start = System.nanoTime(); for (int i = 0; i < 100000; i++) { Query q = new Query(httpRequest, cqp); - assertTrue(q.properties().getBoolean(CompoundName.of("clustering.timeline"), false)); + assertTrue(q.properties().getBoolean(CompoundName.from("clustering.timeline"), false)); } long now = System.nanoTime(); System.out.println("Duration = " + (now - start)/1_000_000 + " ms"); -- cgit v1.2.3