    /*
     *  call-seq:
     *     boolean_query.add_query(query, occur = :should) -> boolean_clause
     *     boolean_query.<<(query, occur = :should) -> boolean_clause
     *     boolean_query << boolean_clause -> boolean_clause
     *
     *  Us this method to add sub-queries to a BooleanQuery. You can either add
     *  a straight Query or a BooleanClause. When adding a Query, the default
     *  occurrence requirement is :should. That is the Query's match will be
     *  scored but it isn't essential for a match. If the query should be
     *  essential, use :must. For exclusive queries use :must_not.
     *
     *  When adding a Boolean clause to a BooleanQuery there is no need to set the
     *  occurrence property because it is already set in the BooleanClause.
     *  Therefor the +occur+ parameter will be ignored in this case.
     *
     *  query::   Query to add to the BooleanQuery
     *  occur::   occurrence requirement for the query being added. Must be one of
     *            [:must, :should, :must_not]
     *  returns:: BooleanClause which was added
     */
    static VALUE
    frt_bq_add_query(int argc, VALUE *argv, VALUE self)
    {
        GET_Q();
        VALUE rquery, roccur;
        enum BC_TYPE occur = BC_SHOULD;
        Query *sub_q;
        VALUE klass;

        if (rb_scan_args(argc, argv, "11", &rquery, &roccur) == 2) {
            occur = frt_get_occur(roccur);
        }
        klass = CLASS_OF(rquery);
        if (klass == cBooleanClause) {
            BooleanClause *bc = (BooleanClause *)DATA_PTR(rquery);
            if (argc > 1) {
                rb_warning("Second argument to BooleanQuery#add is ignored "
                           "when adding BooleanClause");
            }
            bq_add_clause(q, bc);
            return rquery;
        } else if (TYPE(rquery) == T_DATA) {
            Data_Get_Struct(rquery, Query, sub_q);
            return frt_bc_wrap(bq_add_query(q, sub_q, occur));
        } else {
            rb_raise(rb_eArgError, "Cannot add %s to a BooleanQuery",
                     rb_class2name(klass));
        }
        return Qnil;
    }