def METHOD_NAME(self, node, tag=None):
    def to_api(tag, raw_value):
        try:
            api_tag, converter = _QL_TO_SC[tag] if tag else ('q', None)
        except KeyError:
            if tag not in SUPPORTED:
                raise self.Error("Unsupported '%s' tag. Try: %s"
                                 % (tag, ", ". join(SUPPORTED)))
            return None, None
        else:
            value = str(converter(raw_value) if converter else raw_value)
            return api_tag, value
    def terms_from_re(pattern, t):
        """Best efforts to de-regex"""
        pat = pattern.lstrip('^').rstrip('$')
        api_tag, pat = to_api(t, pat)
        return {(api_tag, p) for p in pat.split('|')} if api_tag else set()
    if isinstance(node, Tag) and set(node._names) & SUPPORTED:
        if len(node._names) == 1:
            return self.METHOD_NAME(node.res, tag=node._names[0])
        return self.METHOD_NAME(node.res)
    elif isinstance(node, (Inter, Union)):
        # Treat identically as the text-based query will perform
        # relevance ranking itself, meaning that any term is still useful
        terms = set()
        for n in node.res:
            terms |= self.METHOD_NAME(n)
        return terms
    elif isinstance(node, Numcmp):
        def from_relative(op, l, r):
            raw_value = r.evaluate(_DUMMY_AF, self._clock(), True)
            tag, value = to_api(l._tag, raw_value)
            if not value:
                return set()
            if op == operator.eq:
                return {(tag, value)}
            elif op in (operator.le, operator.lt):
                return {(tag + "[to]", value)}
            elif op in (operator.ge, operator.gt):
                return {(tag + "[from]", value)}
            raise self.Error("Unsupported operator: %s" % op)
        left = node._expr
        right = node._expr2
        if isinstance(left, NumexprTag) and isinstance(right, Numexpr):
            return from_relative(node._op, left, right)
        elif isinstance(right, NumexprTag) and isinstance(left, Numexpr):
            # We can reduce the logic by flipping the expression
            return from_relative(INVERSE_OPS[node._op], right, left)
        raise self.Error("Unsupported numeric: %s" % node)
    elif hasattr(node, 'pattern'):
        return terms_from_re(node.pattern, tag)
    elif isinstance(node, True_):
        return set()
    elif isinstance(node, False_):
        raise self.Error("False can never be queried")
    raise self.Error("Unhandled node: %r" % (node,))