private static void getRelevantKeys(Expression exp, Consumer<String> acceptKey) {
    // if a sub-expression must always be evaluated, then either the whole expression must always be evaluated
    // or there is another part of the expression that limits the elements on which it must be evaluated, so we can
    // ignore keys from this sub-expression.
    if (!mustAlwaysEvaluate(exp)) {
      if (exp instanceof Expression.And and) {
        and.children().forEach(child -> getRelevantKeys(child, acceptKey));
      } else if (exp instanceof Expression.Or or) {
        or.children().forEach(child -> getRelevantKeys(child, acceptKey));
      } else if (exp instanceof Expression.MatchField field) {
        acceptKey.accept(field.field());
      } else if (exp instanceof Expression.MatchAny any && !any.mustAlwaysEvaluate()) {
        acceptKey.accept(any.field());
      }
      // ignore not case since not(matchAny("field", "")) should track "field" as a relevant key, but that gets
      // simplified to matchField("field") so don't need to handle that here
    }
  }
Calls {@code acceptKey} for every tag that could possibly cause {@code exp} to match an input element.
planetiler-core/src/main/java/com/onthegomap/planetiler/expression/MultiExpression.java