summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java25
1 files changed, 14 insertions, 11 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java
index 4c4d6778d86..062b9d8c6e4 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java
@@ -43,10 +43,10 @@ public class QueryProfileVariants implements Freezable, Cloneable {
* Order matters - more specific values to the left in this list are more significant than more specific values
* to the right
*/
- private List<String> dimensions;
+ private final List<String> dimensions;
/** The query profile this variants of */
- private QueryProfile owner;
+ private final QueryProfile owner;
/**
* Creates a set of virtual query profiles which may return varying values over the set of dimensions given.
@@ -105,14 +105,10 @@ public class QueryProfileVariants implements Freezable, Cloneable {
if (contentName != null) {
if (type != null)
contentName = type.unalias(contentName);
- //System.out.println(" accepting single value in " + this + " for local key " + contentName);
acceptSingleValue(contentName, allowContent, visitor, dimensionBinding); // Special cased for performance
- //System.out.println(" done accepting single value in " + this + " for local key " + contentName);
}
else {
- //System.out.println(" accepting all values in " + this);
acceptAllValues(allowContent, visitor, type, dimensionBinding);
- //System.out.println(" done accepting all values in " + this);
}
}
@@ -223,7 +219,7 @@ public class QueryProfileVariants implements Freezable, Cloneable {
ensureNotFrozen();
// Update variant
- getVariant(dimensionValues, true).set(fieldName, value);
+ Object combinedValue = getVariant(dimensionValues, true).set(fieldName, value);
// Update per-variable optimized structure
FieldValues fieldValues = fieldValuesByName.get(fieldName);
@@ -232,7 +228,6 @@ public class QueryProfileVariants implements Freezable, Cloneable {
fieldValuesByName.put(fieldName, fieldValues);
}
- Object combinedValue = QueryProfile.combineValues(value, fieldValues.getExact(dimensionValues));
if (combinedValue != null)
fieldValues.put(dimensionValues, combinedValue);
}
@@ -261,6 +256,7 @@ public class QueryProfileVariants implements Freezable, Cloneable {
return Collections.unmodifiableList(variants);
}
+ @Override
public QueryProfileVariants clone() {
try {
if (frozen) return this;
@@ -308,9 +304,12 @@ public class QueryProfileVariants implements Freezable, Cloneable {
return variant;
}
+ @Override
+ public String toString() { return "variants of " + owner; }
+
public static class FieldValues implements Freezable, Cloneable {
- private List<FieldValue> resolutionList=null;
+ private List<FieldValue> resolutionList = null;
private boolean frozen = false;
@@ -424,7 +423,7 @@ public class QueryProfileVariants implements Freezable, Cloneable {
public static class FieldValue implements Comparable<FieldValue>, Cloneable {
- private DimensionValues dimensionValues;
+ private final DimensionValues dimensionValues;
private Object value;
public FieldValue(DimensionValues dimensionValues, Object value) {
@@ -462,7 +461,7 @@ public class QueryProfileVariants implements Freezable, Cloneable {
}
/** Clone by filling in the value from the given variants */
- public FieldValue clone(String fieldName,List<QueryProfileVariant> clonedVariants) {
+ public FieldValue clone(String fieldName, List<QueryProfileVariant> clonedVariants) {
try {
FieldValue clone = (FieldValue)super.clone();
if (this.value instanceof QueryProfile)
@@ -475,6 +474,7 @@ public class QueryProfileVariants implements Freezable, Cloneable {
}
}
+ @Override
public FieldValue clone() {
try {
FieldValue clone = (FieldValue)super.clone();
@@ -494,6 +494,9 @@ public class QueryProfileVariants implements Freezable, Cloneable {
return null;
}
+ @Override
+ public String toString() { return "field value " + value + " for " + dimensionValues; }
+
}
}