SearchablePtr sptr;
xsltStylesheetPtr xsp;
std::string content_session_id;
+ bool enable_cproxy;
public:
Backend(SearchablePtr sptr);
~Backend();
ZOOM_connection_save_apdu_wrbuf(m_connection, m_apdu_wrbuf);
m_resultset = 0;
xsp = 0;
+ enable_cproxy = true;
}
yf::Zoom::Backend::~Backend()
b->xsp = xsp;
b->m_frontend_database = database;
+ b->enable_cproxy = param_nocproxy ? false : true;
if (sptr->query_encoding.length())
b->set_option("rpnCharset", sptr->query_encoding);
}
package.log("zoom", YLOG_LOG, "url: %s", url.c_str());
b->connect(url, error, addinfo, odr);
- if (*error == 0 && !param_nocproxy)
+ if (*error == 0 && b->enable_cproxy)
create_content_session(package, b, error, addinfo, odr,
content_authentication.length() ?
content_authentication : authentication,
}
}
- if (rec_buf)
+ if (rec_buf && b->enable_cproxy)
{
xmlDoc *doc = xmlParseMemory(rec_buf, rec_len);
std::string res =
log_diagnostic(package, error, addinfo);
apdu_res = odr.create_searchResponse(apdu_req, error, addinfo);
package.response() = apdu_res;
+ cql_parser_destroy(cp);
return;
}
char ccl_buf[1024];
-
r = cql_to_ccl_buf(cn, ccl_buf, sizeof(ccl_buf));
- if (r == 0)
- {
- ccl_wrbuf = wrbuf_alloc();
- wrbuf_puts(ccl_wrbuf, ccl_buf);
-
- WRBUF sru_sortkeys_wrbuf = wrbuf_alloc();
-
- cql_sortby_to_sortkeys(cn, wrbuf_vp_puts, sru_sortkeys_wrbuf);
- 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);
-
- 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)
- {
- sortkeys += " ";
- token = yaz_tok_move(tp);
- }
- }
- yaz_tok_parse_destroy(tp);
- wrbuf_destroy(sort_spec_wrbuf);
- }
- cql_parser_destroy(cp);
if (r)
{
error = YAZ_BIB1_MALFORMED_QUERY;
log_diagnostic(package, error, addinfo);
apdu_res = odr.create_searchResponse(apdu_req, error, addinfo);
package.response() = apdu_res;
+ cql_parser_destroy(cp);
return;
}
+
+ WRBUF sru_sortkeys_wrbuf = wrbuf_alloc();
+ if (cql_sortby_to_sortkeys(cn, wrbuf_vp_puts, sru_sortkeys_wrbuf))
+ {
+ error = YAZ_BIB1_ILLEGAL_SORT_RELATION;
+ const char *addinfo = "CQL to CCL sortby conversion";
+
+ 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)
+ {
+ sortkeys += " ";
+ token = yaz_tok_move(tp);
+ }
+ }
+ yaz_tok_parse_destroy(tp);
+ wrbuf_destroy(sort_spec_wrbuf);
+
+ cql_parser_destroy(cp);
}
else
{