+ log_diagnostic(package, error, addinfo);
+ apdu_res = odr.create_searchResponse(apdu_req, error, addinfo);
+ package.response() = apdu_res;
+ wrbuf_destroy(sru_sortkeys_wrbuf);
+ cql_parser_destroy(cp);
+ return;
+ }
+ WRBUF sort_spec_wrbuf = wrbuf_alloc();
+ yaz_srw_sortkeys_to_sort_spec(wrbuf_cstr(sru_sortkeys_wrbuf),
+ sort_spec_wrbuf);
+ wrbuf_destroy(sru_sortkeys_wrbuf);
+
+ ccl_wrbuf = wrbuf_alloc();
+ wrbuf_puts(ccl_wrbuf, ccl_buf);
+
+ yaz_tok_cfg_t tc = yaz_tok_cfg_create();
+ yaz_tok_parse_t tp =
+ yaz_tok_parse_buf(tc, wrbuf_cstr(sort_spec_wrbuf));
+ yaz_tok_cfg_destroy(tc);
+
+ /* go through sortspec and map fields */
+ int token = yaz_tok_move(tp);
+ while (token != YAZ_TOK_EOF)
+ {
+ if (token == YAZ_TOK_STRING)
+ {
+ const char *field = yaz_tok_parse_string(tp);
+ std::map<std::string,std::string>::iterator it;
+ it = b->sptr->sortmap.find(field);
+ if (it != b->sptr->sortmap.end())
+ sortkeys += it->second;
+ else
+ sortkeys += field;
+ }
+ sortkeys += " ";
+ token = yaz_tok_move(tp);
+ if (token == YAZ_TOK_STRING)
+ {
+ sortkeys += yaz_tok_parse_string(tp);
+ }
+ if (token != YAZ_TOK_EOF)