DynamicOperand newLeft = replaceViewReferences(context, arith.getLeft(), mapping, node);
DynamicOperand newRight = replaceViewReferences(context, arith.getRight(), mapping, node);
return new ArithmeticOperand(newLeft, arith.getOperator(), newRight);
}
if (operand instanceof FullTextSearchScore) {
FullTextSearchScore score = (FullTextSearchScore)operand;
if (!mapping.getOriginalName().equals(score.getSelectorName())) return score;
if (mapping.isMappedToSingleSelector()) {
return new FullTextSearchScore(mapping.getSingleMappedSelectorName());
}
// There are multiple mappings, so we have to create a composite score ...
DynamicOperand composite = null;
for (SelectorName name : mapping.getMappedSelectorNames()) {
FullTextSearchScore mappedScore = new FullTextSearchScore(name);
if (composite == null) {
composite = mappedScore;
} else {
composite = new ArithmeticOperand(composite, ArithmeticOperator.ADD, mappedScore);
}