/*
 *  call-seq:
 *     SpanOrQuery.new(options = {}) -> query
 *
 *  Create a new SpanOrQuery. This is just like a BooleanQuery with all
 *  clauses with the occur value of :should. The difference is that it can be
 *  passed to other SpanQuerys like SpanNearQuery.
 */
static VALUE
frb_spanoq_init(int argc, VALUE *argv, VALUE self)
{
    Query *q;
    VALUE rclauses;

    q = spanoq_new();
    if (rb_scan_args(argc, argv, "01", &rclauses) > 0) {
        int i;
        Query *clause;
        Check_Type(rclauses, T_ARRAY);
        for (i = 0; i < RARRAY_LEN(rclauses); i++) {
            Data_Get_Struct(RARRAY_PTR(rclauses)[i], Query, clause);
            spanoq_add_clause(q, clause);
        }
    }
    Frt_Wrap_Struct(self, &frb_spanoq_mark, &frb_q_free, q);
    object_add(q, self);
    return self;
}