- int i;
- if (zs->which == Z_RPNStructure_complex)
- {
- Z_Operator *op = zs->u.complex->roperator;
- wrbuf_printf(b, "@%s ", complex_op_name(op) );
- if (op->which== Z_Operator_prox)
- {
- wrbuf_printf(b, "(excl=%s dist=%d order=%s "
- "rel=%s unit=%s) ",
- op->u.prox->exclusion ?
- (*op->u.prox->exclusion ? "T" : "F") : "N",
- *op->u.prox->distance,
- *op->u.prox->ordered ? "T" : "F",
- relToStr(*op->u.prox->relationType),
- prox_unit_name(op->u.prox) );
- }
- wrbuf_structure (b,zs->u.complex->s1, ast);
- wrbuf_structure (b,zs->u.complex->s2, ast);
- }
- else if (zs->which == Z_RPNStructure_simple)
- {
- if (zs->u.simple->which == Z_Operand_APT)
- {
- Z_AttributesPlusTerm *zapt = zs->u.simple->u.attributesPlusTerm;
- int num_attributes = zapt->attributes->num_attributes;
- for (i=0;i<num_attributes;i++)
- wrbuf_attr(b,zapt->attributes->attributes[i]);
-
- switch (zapt->term->which)
- {
- case Z_Term_general:
- wrbuf_printf(b, "'%.*s' ",
- zapt->term->u.general->len,
- zapt->term->u.general->buf);
- break;
- case Z_Term_characterString:
- wrbuf_printf(b, "\"%s\" ", zapt->term->u.characterString);
- break;
- case Z_Term_numeric:
- wrbuf_printf(b, "%d ", *zapt->term->u.numeric);
- break;
- case Z_Term_null:
- wrbuf_printf(b, "(null) ");
- break;
- default:
- wrbuf_printf(b, "(unknown term type %d) ", zapt->term->which);
- }
- }
- else if (zs->u.simple->which == Z_Operand_resultSetId)
- {
- wrbuf_printf(b, "@set '%s' ", zs->u.simple->u.resultSetId);
- }
- else
- wrbuf_printf (b, "(unknown simple structure)");
- }
- else
- wrbuf_puts(b, "(unknown structure)");
-}
-
-void log_rpn_query_level (int loglevel, Z_RPNQuery *rpn)
-{
- oident *attrset;
- enum oid_value ast;
-
- attrset = oid_getentbyoid (rpn->attributeSetId);
- if (attrset)
- {
- ast = attrset->value;
- yaz_log (loglevel, "RPN query. Type: %s", attrset->desc);
- }
- else
- {
- ast = VAL_NONE;
- yaz_log (loglevel, "RPN query. Unknown type");
- }
- zlog_structure (rpn->RPNStructure, 0, ast, loglevel);
-}
-
-static void wrbuf_rpn_query(WRBUF b, Z_RPNQuery *rpn)
-{
- oident *attrset;
- enum oid_value ast;
-
- attrset = oid_getentbyoid (rpn->attributeSetId);
- if (attrset)
- {
- ast = attrset->value;
- wrbuf_printf(b, " @attrset %s ", attrset->desc);
- }
- else
- {
- ast = VAL_NONE;
- wrbuf_printf (b, "Unknown:");
- }
- wrbuf_structure (b,rpn->RPNStructure, ast);
-