private function traverse(Node $node)
    {
        $query = '';

        if ($node->getOperator() !== Node::OPERATOR_BLANK) {
            $query .= ' ' . $node->getOperator() . ' ';
        }

        if ($node->getType() === Node::TYPE_CROTCH) {
            $addsParentheses = $node->isNegatingWholeChildren()
                || ($node !== $this->root && \count($node->getChildren()) > 1);

            if ($node->isNegatingWholeChildren()) {
                $query .= '-';
            }

            if ($addsParentheses) {
                $query .= '(';
            }

            foreach ($node->getChildren() as $child) {
                $query .= $this->traverse($child);
            }

            if ($addsParentheses) {
                $query .= ')';
            }
        } else {// if ($node->getType() === Node::TYPE_LEAF) { is always true
            $criteria = $node->getCriteria();
            $countPredicates = \count($criteria->predicates);
            $addsParentheses = $countPredicates > 1;

            if ($countPredicates === 0) {
                $criteria->isNotNull();// where("field"); => field:[* TO *]
                $countPredicates = 1;
            }

            if ($criteria->isNegating) {
                $query .= '-';
            }

            if (! $criteria->isHideFieldName) {
                $query .= $criteria->field . ':';// "field:" prefix
            }

            if ($addsParentheses) {
                $query .= '(';
            }

            $i = 0;
            while ($i < $countPredicates) {
                $query .= $criteria->predicates[$i];

                if (($i + 1) !== $countPredicates) {
                    $query .= ' ';// field:(a b c d...) This falls upon the solr q.op param (default OR)
                }

                $i++;
            }

            if ($addsParentheses) {
                $query .= ')';
            }

            if ($criteria->boost) {
                $query .= '^' . $criteria->boost;// field:foo^5.0
            }
        }

        return $query;
    }