protected Query eq(Operation<?> operation, QueryMetadata metadata,
            boolean ignoreCase) {
        verifyArguments(operation);
        Path<?> path = getPath(operation.getArg(0));
        String field = toField(path);

        if (Number.class.isAssignableFrom(operation.getArg(1).getType())) {
            @SuppressWarnings("unchecked")
            // guarded by previous check
            Constant<? extends Number> rightArg = (Constant<? extends Number>) operation
                    .getArg(1);
            return new TermQuery(new Term(field,
                    convertNumber(rightArg.getConstant())));
        }

        return eq(field, convert(path, operation.getArg(1), metadata),
                ignoreCase);
    }
If the query is a BooleanQuery and it contains a single Occur.MUST_NOT
clause it will be returned as is. Otherwise it will be wrapped in a
BooleanClause with the given Occur.
querydsl-lucene5/src/main/java/com/querydsl/lucene5/LuceneSerializer.java