private int stringToOperator(String operator) {
        if (operator == null) {
            return NOP;
        } else if (operator.equalsIgnoreCase("or")) {
            return OR;
        } else if (operator.equalsIgnoreCase("and")) {
            return AND;
        } else {
            throw new IllegalStateException("Logical operator '" + operator + "' not supported.");
        }
    }
Converts the given operator string to a corresponding operator index. This is necessary to perform a stack
traversal of logic expression.

@param operator The operator to convert.
@return The corresponding index.
document/src/main/java/com/yahoo/document/select/rule/LogicNode.java