aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2020-11-04 18:39:06 +0100
committerJon Bratseth <bratseth@gmail.com>2020-11-04 18:39:06 +0100
commita72b6152b4a16978db0731872e319af2ae63a0ac (patch)
tree00e0f6ce6139110299c2ee4d5c8106be612a282f /container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java
parentac8b4ebae4796b275ff71cc15eb259a22797a913 (diff)
Override in variant references
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java21
1 files changed, 9 insertions, 12 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java
index 6008b046d1a..d0a42e8a1f9 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java
@@ -366,7 +366,7 @@ public class QueryProfile extends FreezableSimpleComponent implements Cloneable
* @throws IllegalArgumentException if the given name is illegal given the types of this or any nested query profile
* @throws IllegalStateException if this query profile is frozen
*/
- public final void set(String name,Object value, DimensionValues dimensionValues, QueryProfileRegistry registry) {
+ public final void set(String name, Object value, DimensionValues dimensionValues, QueryProfileRegistry registry) {
set(new CompoundName(name), value, DimensionBinding.createFrom(getDimensions(), dimensionValues), registry);
}
@@ -527,7 +527,6 @@ public class QueryProfile extends FreezableSimpleComponent implements Cloneable
QueryProfileVisitor visitor,
DimensionBinding dimensionBinding,
QueryProfile owner) {
- //System.out.println(" visiting " + this);
visitor.onQueryProfile(this, dimensionBinding, owner, null);
if (visitor.isDone()) return;
@@ -541,7 +540,6 @@ public class QueryProfile extends FreezableSimpleComponent implements Cloneable
if (visitor.visitInherited())
visitInherited(allowContent, visitor, dimensionBinding, owner);
- //System.out.println(" done visiting " + this);
}
protected void visitVariants(boolean allowContent, QueryProfileVisitor visitor, DimensionBinding dimensionBinding) {
@@ -738,7 +736,7 @@ public class QueryProfile extends FreezableSimpleComponent implements Cloneable
parent.overridable.put(fieldName.last(), overridable);
}
- /** Sets a value to a (possibly non-local) node. The parent query profile holding the value is returned */
+ /** Sets a value to a (possibly non-local) node. */
private void setNode(CompoundName name, Object value, QueryProfileType parentType,
DimensionBinding dimensionBinding, QueryProfileRegistry registry) {
ensureNotFrozen();
@@ -811,19 +809,18 @@ public class QueryProfile extends FreezableSimpleComponent implements Cloneable
validateName(localName);
value = convertToSubstitutionString(value);
- if (dimensionBinding.isNull()) {
- Object combinedValue;
- if (value instanceof QueryProfile)
- combinedValue = combineValues(value, content == null ? null : content.get(localName));
- else
- combinedValue = combineValues(value, localLookup(localName, dimensionBinding));
- if (combinedValue!=null)
+ if (dimensionBinding.isNull()) {
+ Object combinedValue = value instanceof QueryProfile
+ ? combineValues(value, content == null ? null : content.get(localName))
+ : combineValues(value, localLookup(localName, dimensionBinding));
+ if (combinedValue != null)
content.put(localName, combinedValue);
}
else {
- if (variants == null)
+ if (variants == null) {
variants = new QueryProfileVariants(dimensionBinding.getDimensions(), this);
+ }
variants.set(localName, dimensionBinding.getValues(), value);
}
}