+ if (reverse && sr->query && sr->query->which == Z_Query_type_1)
+ {
+ char *addinfo = 0;
+ mp::odr odr;
+ WRBUF cql = wrbuf_alloc();
+
+ int r = m_cql2rpn.rpn2cql_transform(sr->query->u.type_1, cql,
+ odr, &addinfo);
+ if (r)
+ {
+ int error_code = yaz_diag_srw_to_bib1(r);
+
+ Z_APDU *f_apdu =
+ odr.create_searchResponse(apdu_req, error_code, addinfo);
+ package.response() = f_apdu;
+ return;
+ }
+ else
+ {
+ Z_External *ext = (Z_External *)
+ odr_malloc(odr, sizeof(*ext));
+ ext->direct_reference = odr_oiddup(odr,
+ yaz_oid_userinfo_cql);
+ ext->indirect_reference = 0;
+ ext->descriptor = 0;
+ ext->which = Z_External_CQL;
+ ext->u.cql = odr_strdup(odr, wrbuf_cstr(cql));
+
+ sr->query->which = Z_Query_type_104;
+ sr->query->u.type_104 = ext;
+
+ package.request() = gdu;
+ }
+ wrbuf_destroy(cql);
+ }
+ if (!reverse && sr->query && sr->query->which == Z_Query_type_104 &&