SOLR-11947: Rollback inadvertent code change during documentation updates.

This commit is contained in:
Joel Bernstein 2018-03-26 14:48:33 -04:00
parent 1ed4e226ac
commit e69c614cf6
1 changed files with 20 additions and 22 deletions

View File

@ -31,12 +31,10 @@ public class FieldValueEvaluator extends SourceEvaluator {
private static final long serialVersionUID = 1L;
private String fieldName;
private boolean literal;
public FieldValueEvaluator(String fieldName) {
if(fieldName.startsWith("\"") && fieldName.endsWith("\"") && fieldName.length() > 1){
if(fieldName.startsWith("'") && fieldName.endsWith("'") && fieldName.length() > 1){
fieldName = fieldName.substring(1, fieldName.length() - 1);
literal = true;
}
this.fieldName = fieldName;
@ -44,10 +42,6 @@ public class FieldValueEvaluator extends SourceEvaluator {
@Override
public Object evaluate(Tuple tuple) throws IOException {
if(literal) {
return fieldName;
}
Object value = tuple.get(fieldName);
// This is somewhat radical.
@ -90,6 +84,10 @@ public class FieldValueEvaluator extends SourceEvaluator {
}
}
if(value == null) {
return fieldName;
}
return value;
}
@ -101,9 +99,9 @@ public class FieldValueEvaluator extends SourceEvaluator {
@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {
return new Explanation(nodeId.toString())
.withExpressionType(ExpressionType.EVALUATOR)
.withImplementingClass(getClass().getName())
.withExpression(toExpression(factory).toString());
.withExpressionType(ExpressionType.EVALUATOR)
.withImplementingClass(getClass().getName())
.withExpression(toExpression(factory).toString());
}
}