private function queryToAndExpression(LuceneQuery $query)
    {
        $span = new SpanExpression('AND');

        if (!$query->hasTrivialMainQuery())
            $span->addExpression($query->getMainQuery());

        $span->addExpressions($query->getFilterQueries());

        return $span;
    }