summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileCompiler.java
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-01-10 12:23:57 +0100
committerJon Marius Venstad <venstad@gmail.com>2021-01-10 12:23:57 +0100
commita0a55270b4b370238ee949eef62c9c69e82fd76b (patch)
treece5fe04ee748eb4ea9812523fa87d0e5d53a629e /container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileCompiler.java
parenta8fcb9a0eadd03887fb8efd1602c00e71ed9b261 (diff)
Clean up
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileCompiler.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileCompiler.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileCompiler.java b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileCompiler.java
index 24426b379e9..29a997a75dd 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileCompiler.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileCompiler.java
@@ -49,14 +49,13 @@ public class QueryProfileCompiler {
variants.add(new DimensionBindingForPath(DimensionBinding.nullBinding, CompoundName.empty)); // if this contains no variants
log.fine(() -> "Compiling " + in + " having " + variants.size() + " variants");
- Map<CompoundName, Map<String, CompoundName>> pathCache = new HashMap<>();
+ CompoundNameChildCache pathCache = new CompoundNameChildCache();
Map<DimensionBinding, Binding> bindingCache = new HashMap<>();
for (var variant : variants) {
log.finer(() -> "Compiling variant " + variant);
Binding variantBinding = bindingCache.computeIfAbsent(variant.binding(), Binding::createFrom);
for (var entry : in.visitValues(variant.path(), variant.binding().getContext(), pathCache).valuesWithSource().entrySet()) {
- CompoundName fullName = pathCache.computeIfAbsent(variant.path(), __ -> new HashMap<>())
- .computeIfAbsent(entry.getKey(), variant.path()::append);
+ CompoundName fullName = pathCache.append(variant.path, entry.getKey());
values.put(fullName, variantBinding, entry.getValue());
if (entry.getValue().isUnoverridable())
unoverridables.put(fullName, variantBinding, Boolean.TRUE);
@@ -122,7 +121,7 @@ public class QueryProfileCompiler {
trie.forEachPrefixAndChildren((prefixes, childBindings) -> {
Set<DimensionBinding> processed = new HashSet<>();
for (DimensionBindingForPath prefix : prefixes)
- if (processed.add(prefix.binding())) // Only compute once for similar bindings, since path is equals.
+ if (processed.add(prefix.binding())) // Only compute once for similar bindings, since path is equal.
if (hasWildcardBeforeEnd(prefix.binding()))
for (DimensionBinding childBinding : childBindings)
if (childBinding != prefix.binding()) {