+ // RPN
+ pqf_wrbuf = wrbuf_alloc();
+ yaz_rpnquery_to_wrbuf(pqf_wrbuf, query->u.type_1);
+ }
+ else if (query->which == Z_Query_type_2)
+ {
+ // CCL
+ ccl_wrbuf = wrbuf_alloc();
+ wrbuf_write(ccl_wrbuf, (const char *) query->u.type_2->buf,
+ query->u.type_2->len);
+ }
+ else if (query->which == Z_Query_type_104 &&
+ query->u.type_104->which == Z_External_CQL)
+ {
+ // CQL
+ const char *cql = query->u.type_104->u.cql;
+ CQL_parser cp = cql_parser_create();
+ int r = cql_parser_string(cp, cql);
+ if (r)
+ {
+ cql_parser_destroy(cp);
+ apdu_res =
+ odr.create_searchResponse(apdu_req,
+ YAZ_BIB1_MALFORMED_QUERY,
+ "CQL syntax error");
+ package.response() = apdu_res;
+ return;
+ }
+ struct cql_node *cn = cql_parser_result(cp);
+ struct cql_node *cn_error = m_p->convert_cql_fields(cn, odr);
+ if (cn_error)
+ {
+ // hopefully we are getting a ptr to a index+relation+term node
+ addinfo = 0;
+ if (cn_error->which == CQL_NODE_ST)
+ addinfo = cn_error->u.st.index;
+
+ apdu_res =
+ odr.create_searchResponse(apdu_req,
+ YAZ_BIB1_UNSUPP_USE_ATTRIBUTE,
+ addinfo);
+ package.response() = apdu_res;
+ return;
+ }
+ char ccl_buf[1024];