/*
* call-seq:
* clause.to_s -> string
*
* Return a string representation of this clause. This will not be used by
* BooleanQuery#to_s. It is only used by BooleanClause#to_s and will specify
* whether the clause is +:must+, +:should+ or +:must_not+.
*/
static VALUE
frt_bc_to_s(VALUE self)
{
VALUE rstr;
char *qstr, *ostr = "", *str;
int len;
GET_BC();
qstr = bc->query->to_s(bc->query, "");
switch (bc->occur) {
case BC_SHOULD:
ostr = "Should";
break;
case BC_MUST:
ostr = "Must";
break;
case BC_MUST_NOT:
ostr = "Must Not";
break;
}
len = strlen(ostr) + strlen(qstr) + 2;
str = ALLOC_N(char, len);
sprintf(str, "%s:%s", ostr, qstr);
rstr = rb_str_new(str, len);
free(qstr);
free(str);
return rstr;
}