diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search')
24 files changed, 89 insertions, 123 deletions
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 39fd372d2a7..a3b1e6b464b 100644 --- a/container-search/src/main/java/com/yahoo/search/Query.java +++ b/container-search/src/main/java/com/yahoo/search/Query.java @@ -180,23 +180,23 @@ public class Query extends com.yahoo.processing.Request implements Cloneable { //---------------- Static property handling ------------------------------------ - public static final CompoundName OFFSET = new CompoundName("offset"); - public static final CompoundName HITS = new CompoundName("hits"); + public static final CompoundName OFFSET = CompoundName.from("offset"); + public static final CompoundName HITS = CompoundName.from("hits"); - public static final CompoundName QUERY_PROFILE = new CompoundName("queryProfile"); - public static final CompoundName SEARCH_CHAIN = new CompoundName("searchChain"); + public static final CompoundName QUERY_PROFILE = CompoundName.from("queryProfile"); + public static final CompoundName SEARCH_CHAIN = CompoundName.from("searchChain"); - public static final CompoundName NO_CACHE = new CompoundName("noCache"); - public static final CompoundName GROUPING_SESSION_CACHE = new CompoundName("groupingSessionCache"); - public static final CompoundName TIMEOUT = new CompoundName("timeout"); + public static final CompoundName NO_CACHE = CompoundName.from("noCache"); + public static final CompoundName GROUPING_SESSION_CACHE = CompoundName.from("groupingSessionCache"); + public static final CompoundName TIMEOUT = CompoundName.from("timeout"); /** @deprecated use Trace.LEVEL */ @Deprecated // TODO: Remove on Vespa 9 - public static final CompoundName TRACE_LEVEL = new CompoundName("traceLevel"); + public static final CompoundName TRACE_LEVEL = CompoundName.from("traceLevel"); /** @deprecated use Trace.EXPLAIN_LEVEL */ @Deprecated // TODO: Remove on Vespa 9 - public static final CompoundName EXPLAIN_LEVEL = new CompoundName("explainLevel"); + public static final CompoundName EXPLAIN_LEVEL = CompoundName.from("explainLevel"); private static final QueryProfileType argumentType; static { diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/rpc/CompressService.java b/container-search/src/main/java/com/yahoo/search/dispatch/rpc/CompressService.java index 9e7fc9b5b29..c10375a3014 100644 --- a/container-search/src/main/java/com/yahoo/search/dispatch/rpc/CompressService.java +++ b/container-search/src/main/java/com/yahoo/search/dispatch/rpc/CompressService.java @@ -13,7 +13,7 @@ import com.yahoo.search.Query; */ public class CompressService implements CompressPayload { /** The compression method which will be used with rpc dispatch. "lz4" (default) and "none" is supported. */ - public final static CompoundName dispatchCompression = new CompoundName("dispatch.compression"); + public static final CompoundName dispatchCompression = CompoundName.from("dispatch.compression"); private final Compressor compressor = new Compressor(CompressionType.LZ4, 5, 0.95, 256); diff --git a/container-search/src/main/java/com/yahoo/search/federation/FederationSearcher.java b/container-search/src/main/java/com/yahoo/search/federation/FederationSearcher.java index 80a41ffdf22..b8be1dc210b 100644 --- a/container-search/src/main/java/com/yahoo/search/federation/FederationSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/federation/FederationSearcher.java @@ -70,8 +70,8 @@ public class FederationSearcher extends ForkingSearcher { private static final Logger log = Logger.getLogger(FederationSearcher.class.getName()); /** The name of the query property containing the source name added to the query to each source by this */ - public final static CompoundName SOURCENAME = new CompoundName("sourceName"); - public final static CompoundName PROVIDERNAME = new CompoundName("providerName"); + public static final CompoundName SOURCENAME = CompoundName.from("sourceName"); + public static final CompoundName PROVIDERNAME = CompoundName.from("providerName"); public static final String FEDERATION = "Federation"; public static final String LOG_COUNT_PREFIX = "count_"; @@ -686,33 +686,6 @@ public class FederationSearcher extends ForkingSearcher { } - private static class CompoundKey { - - private final String sourceName; - private final String propertyName; - - CompoundKey(String sourceName, String propertyName) { - this.sourceName = sourceName; - this.propertyName = propertyName; - } - - @Override - public int hashCode() { - return sourceName.hashCode() ^ propertyName.hashCode(); - } - - @Override - public boolean equals(Object o) { - CompoundKey rhs = (CompoundKey) o; - return sourceName.equals(rhs.sourceName) && propertyName.equals(rhs.propertyName); - } - - @Override - public String toString() { - return sourceName + '.' + propertyName; - } - } - private static class Window { private final int hits; diff --git a/container-search/src/main/java/com/yahoo/search/grouping/GroupingQueryParser.java b/container-search/src/main/java/com/yahoo/search/grouping/GroupingQueryParser.java index 54194221958..180687d5274 100644 --- a/container-search/src/main/java/com/yahoo/search/grouping/GroupingQueryParser.java +++ b/container-search/src/main/java/com/yahoo/search/grouping/GroupingQueryParser.java @@ -38,13 +38,13 @@ import java.util.TimeZone; public class GroupingQueryParser extends Searcher { public static final String SELECT_PARAMETER_PARSING = "SelectParameterParsing"; - public static final CompoundName PARAM_CONTINUE = new CompoundName("continue"); - public static final CompoundName PARAM_REQUEST = new CompoundName(Select.SELECT); - public static final CompoundName PARAM_TIMEZONE = new CompoundName("timezone"); - @Beta public static final CompoundName PARAM_DEFAULT_MAX_HITS = new CompoundName("grouping.defaultMaxHits"); - @Beta public static final CompoundName PARAM_DEFAULT_MAX_GROUPS = new CompoundName("grouping.defaultMaxGroups"); - @Beta public static final CompoundName PARAM_DEFAULT_PRECISION_FACTOR = new CompoundName("grouping.defaultPrecisionFactor"); - @Beta public static final CompoundName GROUPING_GLOBAL_MAX_GROUPS = new CompoundName("grouping.globalMaxGroups"); + public static final CompoundName PARAM_CONTINUE = CompoundName.from("continue"); + public static final CompoundName PARAM_REQUEST = CompoundName.from(Select.SELECT); + public static final CompoundName PARAM_TIMEZONE = CompoundName.from("timezone"); + @Beta public static final CompoundName PARAM_DEFAULT_MAX_HITS = CompoundName.from("grouping.defaultMaxHits"); + @Beta public static final CompoundName PARAM_DEFAULT_MAX_GROUPS = CompoundName.from("grouping.defaultMaxGroups"); + @Beta public static final CompoundName PARAM_DEFAULT_PRECISION_FACTOR = CompoundName.from("grouping.defaultPrecisionFactor"); + @Beta public static final CompoundName GROUPING_GLOBAL_MAX_GROUPS = CompoundName.from("grouping.globalMaxGroups"); private static final ThreadLocal<ZoneCache> zoneCache = new ThreadLocal<>(); @Override @@ -121,7 +121,6 @@ public class GroupingQueryParser extends Searcher { return val != null ? OptionalDouble.of(val) : OptionalDouble.empty(); } - @SuppressWarnings("serial") private static class ZoneCache extends LinkedHashMap<String, TimeZone> { ZoneCache() { diff --git a/container-search/src/main/java/com/yahoo/search/grouping/GroupingValidator.java b/container-search/src/main/java/com/yahoo/search/grouping/GroupingValidator.java index 35cf72d6124..878fbbb733d 100644 --- a/container-search/src/main/java/com/yahoo/search/grouping/GroupingValidator.java +++ b/container-search/src/main/java/com/yahoo/search/grouping/GroupingValidator.java @@ -37,7 +37,7 @@ import static com.yahoo.search.grouping.GroupingQueryParser.SELECT_PARAMETER_PAR public class GroupingValidator extends Searcher { public static final String GROUPING_VALIDATED = "GroupingValidated"; - public static final CompoundName PARAM_ENABLED = new CompoundName("validate_" + GroupingQueryParser.PARAM_REQUEST); + public static final CompoundName PARAM_ENABLED = CompoundName.from("validate_" + GroupingQueryParser.PARAM_REQUEST); private final HashMap<String, AttributesConfig.Attribute> attributes = new HashMap<>(); private final String clusterName; private final boolean enabled; diff --git a/container-search/src/main/java/com/yahoo/search/grouping/UniqueGroupingSearcher.java b/container-search/src/main/java/com/yahoo/search/grouping/UniqueGroupingSearcher.java index a1446367f79..27d8a76511d 100644 --- a/container-search/src/main/java/com/yahoo/search/grouping/UniqueGroupingSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/grouping/UniqueGroupingSearcher.java @@ -42,7 +42,7 @@ import java.util.logging.Logger; @Before(PhaseNames.TRANSFORMED_QUERY) public class UniqueGroupingSearcher extends Searcher { - public static final CompoundName PARAM_UNIQUE = new CompoundName("unique"); + public static final CompoundName PARAM_UNIQUE = CompoundName.from("unique"); private static final Logger log = Logger.getLogger(UniqueGroupingSearcher.class.getName()); private static final HitOrderer NOP_ORDERER = new HitOrderer() { @@ -144,17 +144,13 @@ public class UniqueGroupingSearcher extends Searcher { for (Sorting.FieldOrder fieldOrder : sortingSpec.fieldOrders()) { Sorting.Order sortOrder = fieldOrder.getSortOrder(); switch (sortOrder) { - case ASCENDING: - case UNDEFINED: - // When we want ascending order, the hit with the smallest value should come first (and be surfaced). - orderingClause.add(new MinAggregator(new AttributeValue(fieldOrder.getFieldName()))); - break; - case DESCENDING: - // When we sort in descending order, the hit with the largest value should come first (and be surfaced). - orderingClause.add(new NegFunction(new MaxAggregator(new AttributeValue(fieldOrder.getFieldName())))); - break; - default: - throw new UnsupportedOperationException("Can not handle sort order " + sortOrder + "."); + case ASCENDING, UNDEFINED -> + // When we want ascending order, the hit with the smallest value should come first (and be surfaced). + orderingClause.add(new MinAggregator(new AttributeValue(fieldOrder.getFieldName()))); + case DESCENDING -> + // When we sort in descending order, the hit with the largest value should come first (and be surfaced). + orderingClause.add(new NegFunction(new MaxAggregator(new AttributeValue(fieldOrder.getFieldName())))); + default -> throw new UnsupportedOperationException("Can not handle sort order " + sortOrder + "."); } } return orderingClause; @@ -170,18 +166,13 @@ public class UniqueGroupingSearcher extends Searcher { GroupingExpression groupingClause = null; for (Sorting.FieldOrder fieldOrder : sortingSpec.fieldOrders()) { Sorting.Order sortOrder = fieldOrder.getSortOrder(); - switch (sortOrder) { - case ASCENDING: - case UNDEFINED: - groupingClause = new AttributeValue(fieldOrder.getFieldName()); - break; - case DESCENDING: - // To sort descending, just take the negative. This is the most common case - groupingClause = new NegFunction(new AttributeValue(fieldOrder.getFieldName())); - break; - default: - throw new UnsupportedOperationException("Can not handle sort order " + sortOrder + "."); - } + groupingClause = switch (sortOrder) { + case ASCENDING, UNDEFINED -> new AttributeValue(fieldOrder.getFieldName()); + case DESCENDING -> + // To sort descending, just take the negative. This is the most common case + new NegFunction(new AttributeValue(fieldOrder.getFieldName())); + default -> throw new UnsupportedOperationException("Can not handle sort order " + sortOrder + "."); + }; } return groupingClause; } diff --git a/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java b/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java index fac6c598e4b..3b4d15f788f 100644 --- a/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java +++ b/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java @@ -75,8 +75,8 @@ public class SearchHandler extends LoggingRequestHandler { // max number of threads for the executor for this handler private final int maxThreads; - private static final CompoundName DETAILED_TIMING_LOGGING = new CompoundName("trace.timingDetails"); - private static final CompoundName FORCE_TIMESTAMPS = new CompoundName("trace.timestamps"); + private static final CompoundName DETAILED_TIMING_LOGGING = CompoundName.from("trace.timingDetails"); + private static final CompoundName FORCE_TIMESTAMPS = CompoundName.from("trace.timestamps"); /** Event name for number of connections to the search subsystem */ private static final String SEARCH_CONNECTIONS = "search_connections"; diff --git a/container-search/src/main/java/com/yahoo/search/intent/model/IntentModel.java b/container-search/src/main/java/com/yahoo/search/intent/model/IntentModel.java index 9aafd2c4693..0c4b22fbbf2 100644 --- a/container-search/src/main/java/com/yahoo/search/intent/model/IntentModel.java +++ b/container-search/src/main/java/com/yahoo/search/intent/model/IntentModel.java @@ -5,7 +5,12 @@ import com.yahoo.search.Query; import com.yahoo.processing.request.CompoundName; import com.yahoo.text.interpretation.Interpretation; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * This is the root node of an intent model. @@ -19,9 +24,9 @@ import java.util.*; public class IntentModel extends ParentNode<InterpretationNode> { /** The name of the property carrying the intent model string: intentModel */ - public static final CompoundName intentModelStringName=new CompoundName("intentModel"); + public static final CompoundName intentModelStringName = CompoundName.from("intentModel"); /** The name of the property carrying the intent model object: IntentModel */ - public static final CompoundName intentModelObjectName=new CompoundName("IntentModel"); + public static final CompoundName intentModelObjectName = CompoundName.from("IntentModel"); private static final InterpretationNodeComparator inodeComp = new InterpretationNodeComparator(); @@ -45,7 +50,7 @@ public class IntentModel extends ParentNode<InterpretationNode> { /** Sort interpretations by descending score order */ public void sortChildren() { - Collections.sort(children(), inodeComp); + children().sort(inodeComp); } /** diff --git a/container-search/src/main/java/com/yahoo/search/pagetemplates/PageTemplateSearcher.java b/container-search/src/main/java/com/yahoo/search/pagetemplates/PageTemplateSearcher.java index c23627accf4..5fef1821de2 100644 --- a/container-search/src/main/java/com/yahoo/search/pagetemplates/PageTemplateSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/pagetemplates/PageTemplateSearcher.java @@ -72,13 +72,13 @@ import java.util.Map; public class PageTemplateSearcher extends Searcher { /** The name of the query property containing the resolved candidate page template list */ - public static final CompoundName pagePageTemplateListName=new CompoundName("page.PageTemplateList"); + public static final CompoundName pagePageTemplateListName = CompoundName.from("page.PageTemplateList"); /** The name of the query property containing a list of candidate pages to consider */ - public static final CompoundName pageIdListName=new CompoundName("page.idList"); + public static final CompoundName pageIdListName = CompoundName.from("page.idList"); /** The name of the query property containing the page id to use */ - public static final CompoundName pageIdName=new CompoundName("page.id"); + public static final CompoundName pageIdName = CompoundName.from("page.id"); /** The name of the query property containing the resolver id to use */ - public static final CompoundName pageResolverName=new CompoundName("page.resolver"); + public static final CompoundName pageResolverName = CompoundName.from("page.resolver"); private final ResolverRegistry resolverRegistry; diff --git a/container-search/src/main/java/com/yahoo/search/query/Model.java b/container-search/src/main/java/com/yahoo/search/query/Model.java index 190ad675015..09b2f394f20 100644 --- a/container-search/src/main/java/com/yahoo/search/query/Model.java +++ b/container-search/src/main/java/com/yahoo/search/query/Model.java @@ -71,13 +71,13 @@ public class Model implements Cloneable { argumentType.addField(new FieldDescription(SEARCH_PATH, "string", "searchpath")); argumentType.addField(new FieldDescription(RESTRICT, "string", "restrict")); argumentType.freeze(); - argumentTypeName = new CompoundName(argumentType.getId().getName()); + argumentTypeName = CompoundName.from(argumentType.getId().getName()); } public static QueryProfileType getArgumentType() { return argumentType; } /** The name of the query property used for generating hit count estimate queries. */ - public static final CompoundName ESTIMATE = new CompoundName("hitcountestimate"); // TODO: Cleanup + public static final CompoundName ESTIMATE = CompoundName.from("hitcountestimate"); // TODO: Cleanup private String encoding = null; private String queryString = ""; diff --git a/container-search/src/main/java/com/yahoo/search/query/Ranking.java b/container-search/src/main/java/com/yahoo/search/query/Ranking.java index e8738a19412..5426268d173 100644 --- a/container-search/src/main/java/com/yahoo/search/query/Ranking.java +++ b/container-search/src/main/java/com/yahoo/search/query/Ranking.java @@ -27,7 +27,7 @@ import java.util.Objects; public class Ranking implements Cloneable { /** An alias for listing features */ - public static final CompoundName RANKFEATURES = new CompoundName("rankfeatures"); + public static final CompoundName RANKFEATURES = CompoundName.from("rankfeatures"); /** The type representing the property arguments consumed by this */ private static final QueryProfileType argumentType; @@ -70,7 +70,7 @@ public class Ranking implements Cloneable { argumentType.addField(new FieldDescription(FEATURES, "query-profile", "rankfeature input")); // Repeated at the end of RankFeatures argumentType.addField(new FieldDescription(PROPERTIES, "query-profile", "rankproperty")); argumentType.freeze(); - argumentTypeName = new CompoundName(argumentType.getId().getName()); + argumentTypeName = CompoundName.from(argumentType.getId().getName()); } public static QueryProfileType getArgumentType() { return argumentType; } diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/DefaultProperties.java b/container-search/src/main/java/com/yahoo/search/query/properties/DefaultProperties.java index 221368afeb6..6ccf4792efb 100644 --- a/container-search/src/main/java/com/yahoo/search/query/properties/DefaultProperties.java +++ b/container-search/src/main/java/com/yahoo/search/query/properties/DefaultProperties.java @@ -16,9 +16,9 @@ import java.util.Map; */ public final class DefaultProperties extends Properties { - public static final CompoundName MAX_OFFSET = new CompoundName("maxOffset"); - public static final CompoundName MAX_HITS = new CompoundName("maxHits"); - public static final CompoundName MAX_QUERY_ITEMS = new CompoundName("maxQueryItems"); + public static final CompoundName MAX_OFFSET = CompoundName.from("maxOffset"); + public static final CompoundName MAX_HITS = CompoundName.from("maxHits"); + public static final CompoundName MAX_QUERY_ITEMS = CompoundName.from("maxQueryItems"); public static final QueryProfileType argumentType = new QueryProfileType("DefaultProperties"); diff --git a/container-search/src/main/java/com/yahoo/search/query/rewrite/RewriterConstants.java b/container-search/src/main/java/com/yahoo/search/query/rewrite/RewriterConstants.java index b0fce45de46..eeb8b675ae1 100644 --- a/container-search/src/main/java/com/yahoo/search/query/rewrite/RewriterConstants.java +++ b/container-search/src/main/java/com/yahoo/search/query/rewrite/RewriterConstants.java @@ -42,7 +42,7 @@ public class RewriterConstants { public static final String REWRITER_CHAIN = "QRWChain"; /** Name for rewrite metadata retrieval from query properties */ - public static final CompoundName REWRITE_META = new CompoundName("RewriteMeta"); + public static final CompoundName REWRITE_META = CompoundName.from("RewriteMeta"); /** Name for rewritten field retrieval from query properties */ public static final String REWRITTEN = "Rewritten"; diff --git a/container-search/src/main/java/com/yahoo/search/querytransform/BooleanSearcher.java b/container-search/src/main/java/com/yahoo/search/querytransform/BooleanSearcher.java index f43be20e0ac..91315fe1bb3 100644 --- a/container-search/src/main/java/com/yahoo/search/querytransform/BooleanSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/querytransform/BooleanSearcher.java @@ -28,9 +28,9 @@ import static com.yahoo.yolean.Exceptions.toMessageString; @Provides(BooleanSearcher.PREDICATE) public class BooleanSearcher extends Searcher { - private static final CompoundName FIELD = new CompoundName("boolean.field"); - private static final CompoundName ATTRIBUTES = new CompoundName("boolean.attributes"); - private static final CompoundName RANGE_ATTRIBUTES = new CompoundName("boolean.rangeAttributes"); + private static final CompoundName FIELD = CompoundName.from("boolean.field"); + private static final CompoundName ATTRIBUTES = CompoundName.from("boolean.attributes"); + private static final CompoundName RANGE_ATTRIBUTES = CompoundName.from("boolean.rangeAttributes"); public static final String PREDICATE = "predicate"; @Override diff --git a/container-search/src/main/java/com/yahoo/search/querytransform/SortingDegrader.java b/container-search/src/main/java/com/yahoo/search/querytransform/SortingDegrader.java index 75b06c29193..81881685a1d 100644 --- a/container-search/src/main/java/com/yahoo/search/querytransform/SortingDegrader.java +++ b/container-search/src/main/java/com/yahoo/search/querytransform/SortingDegrader.java @@ -41,9 +41,9 @@ public class SortingDegrader extends Searcher { /** Set this to false in query.properties to turn off degrading. Default: on */ // (this is not called ranking.sorting.degrading because it should not be part of the query object model - public static final CompoundName DEGRADING = new CompoundName("sorting.degrading"); + public static final CompoundName DEGRADING = CompoundName.from("sorting.degrading"); - public static final CompoundName PAGINATION = new CompoundName("to_be_removed_pagination"); + public static final CompoundName PAGINATION = CompoundName.from("to_be_removed_pagination"); @Override public Result search(Query query, Execution execution) { diff --git a/container-search/src/main/java/com/yahoo/search/querytransform/WandSearcher.java b/container-search/src/main/java/com/yahoo/search/querytransform/WandSearcher.java index 89245eaf137..bfac668b6c4 100644 --- a/container-search/src/main/java/com/yahoo/search/querytransform/WandSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/querytransform/WandSearcher.java @@ -63,12 +63,12 @@ public class WandSearcher extends Searcher { */ private static class InputResolver { - private static final CompoundName WAND_FIELD = new CompoundName("wand.field"); - private static final CompoundName WAND_TOKENS = new CompoundName("wand.tokens"); - private static final CompoundName WAND_HEAP_SIZE = new CompoundName("wand.heapSize"); - private static final CompoundName WAND_TYPE = new CompoundName("wand.type"); - private static final CompoundName WAND_SCORE_THRESHOLD = new CompoundName("wand.scoreThreshold"); - private static final CompoundName WAND_THRESHOLD_BOOST_FACTOR = new CompoundName("wand.thresholdBoostFactor"); + private static final CompoundName WAND_FIELD = CompoundName.from("wand.field"); + private static final CompoundName WAND_TOKENS = CompoundName.from("wand.tokens"); + private static final CompoundName WAND_HEAP_SIZE = CompoundName.from("wand.heapSize"); + private static final CompoundName WAND_TYPE = CompoundName.from("wand.type"); + private static final CompoundName WAND_SCORE_THRESHOLD = CompoundName.from("wand.scoreThreshold"); + private static final CompoundName WAND_THRESHOLD_BOOST_FACTOR = CompoundName.from("wand.thresholdBoostFactor"); private final String fieldName; private final WandType wandType; private final Map<Object, Integer> tokens; diff --git a/container-search/src/main/java/com/yahoo/search/querytransform/WeakAndReplacementSearcher.java b/container-search/src/main/java/com/yahoo/search/querytransform/WeakAndReplacementSearcher.java index 2d6e059342e..9aa7a9d998d 100644 --- a/container-search/src/main/java/com/yahoo/search/querytransform/WeakAndReplacementSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/querytransform/WeakAndReplacementSearcher.java @@ -21,8 +21,8 @@ import com.yahoo.yolean.chain.After; */ @After(MinimalQueryInserter.EXTERNAL_YQL) public class WeakAndReplacementSearcher extends Searcher { - static final CompoundName WEAKAND_REPLACE = new CompoundName("weakAnd.replace"); - static final CompoundName WAND_HITS = new CompoundName("wand.hits"); + static final CompoundName WEAKAND_REPLACE = CompoundName.from("weakAnd.replace"); + static final CompoundName WAND_HITS = CompoundName.from("wand.hits"); @Override public Result search(Query query, Execution execution) { if (!query.properties().getBoolean(WEAKAND_REPLACE)) { diff --git a/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java b/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java index 44620179c1d..b36c8788877 100644 --- a/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java +++ b/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java @@ -76,10 +76,10 @@ import static com.fasterxml.jackson.databind.SerializationFeature.FLUSH_AFTER_WR // NOTE: The JSON format is a public API. If new elements are added be sure to update the reference doc. public class JsonRenderer extends AsynchronousSectionedRenderer<Result> { - private static final CompoundName WRAP_DEEP_MAPS = new CompoundName("renderer.json.jsonMaps"); - private static final CompoundName WRAP_WSETS = new CompoundName("renderer.json.jsonWsets"); - private static final CompoundName DEBUG_RENDERING_KEY = new CompoundName("renderer.json.debug"); - private static final CompoundName JSON_CALLBACK = new CompoundName("jsoncallback"); + private static final CompoundName WRAP_DEEP_MAPS = CompoundName.from("renderer.json.jsonMaps"); + private static final CompoundName WRAP_WSETS = CompoundName.from("renderer.json.jsonWsets"); + private static final CompoundName DEBUG_RENDERING_KEY = CompoundName.from("renderer.json.debug"); + private static final CompoundName JSON_CALLBACK = CompoundName.from("jsoncallback"); // if this must be optimized, simply use com.fasterxml.jackson.core.SerializableString private static final String BUCKET_LIMITS = "limits"; diff --git a/container-search/src/main/java/com/yahoo/search/searchers/CacheControlSearcher.java b/container-search/src/main/java/com/yahoo/search/searchers/CacheControlSearcher.java index a4f03b088f2..29e8afa41ac 100644 --- a/container-search/src/main/java/com/yahoo/search/searchers/CacheControlSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/searchers/CacheControlSearcher.java @@ -32,9 +32,9 @@ import com.yahoo.search.searchchain.Execution; */ public class CacheControlSearcher extends Searcher { - private static final CompoundName cachecontrolNocache=new CompoundName("cachecontrol.nocache"); - private static final CompoundName cachecontrolMaxage=new CompoundName("cachecontrol.maxage"); - private static final CompoundName cachecontrolStaleage=new CompoundName("cachecontrol.staleage"); + private static final CompoundName cachecontrolNocache=CompoundName.from("cachecontrol.nocache"); + private static final CompoundName cachecontrolMaxage=CompoundName.from("cachecontrol.maxage"); + private static final CompoundName cachecontrolStaleage=CompoundName.from("cachecontrol.staleage"); public static final String CACHE_CONTROL_HEADER = "Cache-Control"; diff --git a/container-search/src/main/java/com/yahoo/search/searchers/ConnectionControlSearcher.java b/container-search/src/main/java/com/yahoo/search/searchers/ConnectionControlSearcher.java index 90cb05be1f8..18588b2026d 100644 --- a/container-search/src/main/java/com/yahoo/search/searchers/ConnectionControlSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/searchers/ConnectionControlSearcher.java @@ -49,7 +49,7 @@ public class ConnectionControlSearcher extends Searcher { private final LongSupplier clock; - private static final CompoundName KEEPALIVE_MAXLIFETIMESECONDS = new CompoundName("connectioncontrol.maxlifetime"); + private static final CompoundName KEEPALIVE_MAXLIFETIMESECONDS = CompoundName.from("connectioncontrol.maxlifetime"); private static final String HTTP_CONNECTION_HEADER_NAME = "Connection"; private static final String HTTP_CONNECTION_CLOSE_ARGUMENT = "Close"; diff --git a/container-search/src/main/java/com/yahoo/search/searchers/RateLimitingSearcher.java b/container-search/src/main/java/com/yahoo/search/searchers/RateLimitingSearcher.java index cf81f62f64d..35a3c86f763 100755 --- a/container-search/src/main/java/com/yahoo/search/searchers/RateLimitingSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/searchers/RateLimitingSearcher.java @@ -54,11 +54,11 @@ public class RateLimitingSearcher extends Searcher { /** Constant containing the name this Provides - "rateLimiting", for ordering constraints */ public static final String RATE_LIMITING = "rateLimiting"; - public static final CompoundName idKey = new CompoundName("rate.id"); - public static final CompoundName costKey = new CompoundName("rate.cost"); - public static final CompoundName quotaKey = new CompoundName("rate.quota"); - public static final CompoundName idDimensionKey = new CompoundName("rate.idDimension"); - public static final CompoundName dryRunKey = new CompoundName("rate.dryRun"); + public static final CompoundName idKey = CompoundName.from("rate.id"); + public static final CompoundName costKey = CompoundName.from("rate.cost"); + public static final CompoundName quotaKey = CompoundName.from("rate.quota"); + public static final CompoundName idDimensionKey = CompoundName.from("rate.idDimension"); + public static final CompoundName dryRunKey = CompoundName.from("rate.dryRun"); private static final String requestsOverQuotaMetricName = "requestsOverQuota"; diff --git a/container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java b/container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java index 833c1251a7b..6961a189d22 100644 --- a/container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java +++ b/container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java @@ -27,7 +27,7 @@ public class FieldFiller extends Searcher { private final Set<String> intersectionOfAttributes; private final SchemaInfo schemaInfo; - public static final CompoundName FIELD_FILLER_DISABLE = new CompoundName("FieldFiller.disable"); + public static final CompoundName FIELD_FILLER_DISABLE = CompoundName.from("FieldFiller.disable"); public FieldFiller(SchemaInfo schemaInfo) { this.schemaInfo = schemaInfo; diff --git a/container-search/src/main/java/com/yahoo/search/yql/FieldFilter.java b/container-search/src/main/java/com/yahoo/search/yql/FieldFilter.java index 8cc6a1b42b9..df9722d3214 100644 --- a/container-search/src/main/java/com/yahoo/search/yql/FieldFilter.java +++ b/container-search/src/main/java/com/yahoo/search/yql/FieldFilter.java @@ -2,13 +2,11 @@ package com.yahoo.search.yql; import java.util.Iterator; -import java.util.Map.Entry; import java.util.Set; import com.yahoo.api.annotations.Beta; import com.yahoo.component.chain.dependencies.After; import com.yahoo.component.chain.dependencies.Before; -import com.yahoo.prelude.fastsearch.FastHit; import com.yahoo.processing.request.CompoundName; import com.yahoo.search.Query; import com.yahoo.search.Result; @@ -27,7 +25,7 @@ import com.yahoo.search.searchchain.Execution; @Before("com.yahoo.search.yql.FieldFiller") public class FieldFilter extends Searcher { - public static final CompoundName FIELD_FILTER_DISABLE = new CompoundName("FieldFilter.disable"); + public static final CompoundName FIELD_FILTER_DISABLE = CompoundName.from("FieldFilter.disable"); /** Fields that should be kept even if not explicitly requested */ private static final Set<String> syntheticFields = Set.of("matchfeatures", "rankfeatures", "summaryfeatures"); diff --git a/container-search/src/main/java/com/yahoo/search/yql/MinimalQueryInserter.java b/container-search/src/main/java/com/yahoo/search/yql/MinimalQueryInserter.java index e844bac21e8..ee4f931d532 100644 --- a/container-search/src/main/java/com/yahoo/search/yql/MinimalQueryInserter.java +++ b/container-search/src/main/java/com/yahoo/search/yql/MinimalQueryInserter.java @@ -39,10 +39,10 @@ public class MinimalQueryInserter extends Searcher { public static final String EXTERNAL_YQL = "ExternalYql"; - public static final CompoundName YQL = new CompoundName("yql"); + public static final CompoundName YQL = CompoundName.from("yql"); - private static final CompoundName MAX_HITS = new CompoundName("maxHits"); - private static final CompoundName MAX_OFFSET = new CompoundName("maxOffset"); + private static final CompoundName MAX_HITS = CompoundName.from("maxHits"); + private static final CompoundName MAX_OFFSET = CompoundName.from("maxOffset"); private static final Logger log = Logger.getLogger(MinimalQueryInserter.class.getName()); @Inject |