switch (queryType)
{
case QueryType_CQL:
- sr->u.scan_request->query_type = Z_SRW_query_type_cql;
- sr->u.scan_request->scanClause.cql = encode_SRW_term(out, arg);
+ sr->u.scan_request->queryType = "cql";
+ sr->u.scan_request->scanClause = encode_SRW_term(out, arg);
break;
case QueryType_Prefix:
- sr->u.scan_request->query_type = Z_SRW_query_type_pqf;
- sr->u.scan_request->scanClause.pqf = encode_SRW_term(out, arg);
+ sr->u.scan_request->queryType = "pqf";
+ sr->u.scan_request->scanClause = encode_SRW_term(out, arg);
break;
default:
printf("Only CQL and PQF supported in SRW\n");
switch (queryType)
{
case QueryType_CQL:
- srw_sr->u.request->query_type = Z_SRW_query_type_cql;
- srw_sr->u.request->query.cql = encode_SRW_term(srw_sr_odr_out, arg);
+ srw_sr->u.request->queryType = "cql";
+ srw_sr->u.request->query = encode_SRW_term(srw_sr_odr_out, arg);
- sr->u.request->query_type = Z_SRW_query_type_cql;
- sr->u.request->query.cql = encode_SRW_term(srw_sr_odr_out, arg);
+ sr->u.request->queryType = "cql";
+ sr->u.request->query = encode_SRW_term(srw_sr_odr_out, arg);
break;
case QueryType_Prefix:
- srw_sr->u.request->query_type = Z_SRW_query_type_pqf;
- srw_sr->u.request->query.pqf = encode_SRW_term(srw_sr_odr_out, arg);
+ srw_sr->u.request->queryType = "pqf";
+ srw_sr->u.request->query = encode_SRW_term(srw_sr_odr_out, arg);
- sr->u.request->query_type = Z_SRW_query_type_pqf;
- sr->u.request->query.pqf = encode_SRW_term(srw_sr_odr_out, arg);
+ sr->u.request->queryType = "pqf";
+ sr->u.request->query = encode_SRW_term(srw_sr_odr_out, arg);
break;
default:
printf("Only CQL and PQF supported in SRW\n");
typedef struct {
-#define Z_SRW_query_type_cql 1
-#define Z_SRW_query_type_xcql 2
-#define Z_SRW_query_type_pqf 3
- int query_type;
- union {
- char *cql;
- char *xcql;
- char *pqf;
- } query;
+ char *queryType;
+ char *query;
#define Z_SRW_sort_type_none 1
#define Z_SRW_sort_type_sort 2
} Z_SRW_explainResponse;
typedef struct {
- int query_type;
- union {
- char *cql;
- char *xcql;
- char *pqf;
- } scanClause;
+ char *queryType;
+ char *scanClause;
Odr_int *responsePosition;
Odr_int *maximumTerms;
char *stylesheet;
const char *sterm = 0;
size_t lterm = 0;
Odr_int trunc = get_truncation(apt);
+ char *close_range = 0;
wrbuf_rewind(w);
- char *close_range = 0;
ret = rpn2solr_attr(ct, apt->attributes, w, &close_range);
if (trunc == 0 || trunc == 1 || trunc == 100 || trunc == 104)
rr.present_number = srw_req->maximumRecords ?
*srw_req->maximumRecords : 0;
- if (srw_req->query_type == Z_SRW_query_type_cql)
+ if (!srw_req->queryType || !strcmp(srw_req->queryType, "cql"))
{
if (assoc->server && assoc->server->cql_transform)
{
- int srw_errcode = cql2pqf(assoc->encode, srw_req->query.cql,
+ int srw_errcode = cql2pqf(assoc->encode, srw_req->query,
assoc->server->cql_transform,
rr.query,
&rr.srw_sortKeys);
ext->indirect_reference = 0;
ext->descriptor = 0;
ext->which = Z_External_CQL;
- ext->u.cql = srw_req->query.cql;
+ ext->u.cql = srw_req->query;
rr.query->which = Z_Query_type_104;
rr.query->u.type_104 = ext;
}
}
- else if (srw_req->query_type == Z_SRW_query_type_pqf)
+ else if (!strcmp(srw_req->queryType, "pqf"))
{
Z_RPNQuery *RPNquery;
YAZ_PQF_Parser pqf_parser;
pqf_parser = yaz_pqf_create();
- RPNquery = yaz_pqf_parse(pqf_parser, assoc->decode,
- srw_req->query.pqf);
+ RPNquery = yaz_pqf_parse(pqf_parser, assoc->decode, srw_req->query);
if (!RPNquery)
{
const char *pqf_msg;
}
if (log_request)
{
- const char *querystr = "?";
- const char *querytype = "?";
WRBUF wr = wrbuf_alloc();
- switch (srw_req->query_type)
- {
- case Z_SRW_query_type_cql:
- querytype = "CQL";
- querystr = srw_req->query.cql;
- break;
- case Z_SRW_query_type_pqf:
- querytype = "PQF";
- querystr = srw_req->query.pqf;
- break;
- }
wrbuf_printf(wr, "SRWSearch %s ", srw_req->database);
if (srw_res->num_diagnostics)
wrbuf_printf(wr, "ERROR %s", srw_res->diagnostics[0].uri);
srw_res->resultSetId : "-"),
(srw_req->startRecord ? *srw_req->startRecord : 1),
srw_res->num_records);
- yaz_log(log_request, "%s %s: %s", wrbuf_cstr(wr), querytype, querystr);
+ yaz_log(log_request, "%s %s: %s", wrbuf_cstr(wr), srw_req->queryType,
+ srw_req->query);
wrbuf_destroy(wr);
}
}
}
save_entries = bsrr->entries; /* save it so we can compare later */
- if (srw_req->query_type == Z_SRW_query_type_pqf &&
+ if (srw_req->queryType && !strcmp(srw_req->queryType, "pqf") &&
assoc->init->bend_scan)
{
YAZ_PQF_Parser pqf_parser = yaz_pqf_create();
bsrr->term = yaz_pqf_scan(pqf_parser, assoc->decode,
&bsrr->attributeset,
- srw_req->scanClause.pqf);
+ srw_req->scanClause);
yaz_pqf_destroy(pqf_parser);
bsrr->scanClause = 0;
((int (*)(void *, bend_scan_rr *))
(*assoc->init->bend_scan))(assoc->backend, bsrr);
}
- else if (srw_req->query_type == Z_SRW_query_type_cql
+ else if ((!srw_req->queryType || !strcmp(srw_req->queryType, "cql"))
&& assoc->init->bend_scan && assoc->server
&& assoc->server->cql_transform)
{
bsrr->term = (Z_AttributesPlusTerm *)
odr_malloc(assoc->decode, sizeof(*bsrr->term));
srw_error = cql2pqf_scan(assoc->encode,
- srw_req->scanClause.cql,
+ srw_req->scanClause,
assoc->server->cql_transform,
bsrr->term);
if (srw_error)
(*assoc->init->bend_scan))(assoc->backend, bsrr);
}
}
- else if (srw_req->query_type == Z_SRW_query_type_cql
+ else if ((!srw_req->queryType || !strcmp(srw_req->queryType, "cql"))
&& assoc->init->bend_srw_scan)
{
bsrr->term = 0;
bsrr->attributeset = 0;
- bsrr->scanClause = srw_req->scanClause.cql;
+ bsrr->scanClause = srw_req->scanClause;
((int (*)(void *, bend_scan_rr *))
(*assoc->init->bend_srw_scan))(assoc->backend, bsrr);
}
if (log_request)
{
WRBUF wr = wrbuf_alloc();
- const char *querytype = 0;
- const char *querystr = 0;
-
- switch(srw_req->query_type)
- {
- case Z_SRW_query_type_pqf:
- querytype = "PQF";
- querystr = srw_req->scanClause.pqf;
- break;
- case Z_SRW_query_type_cql:
- querytype = "CQL";
- querystr = srw_req->scanClause.cql;
- break;
- default:
- querytype = "UNKNOWN";
- querystr = "";
- }
-
wrbuf_printf(wr, "SRWScan %s ", srw_req->database);
if (srw_res->num_diagnostics)
(srw_req->maximumTerms ?
*srw_req->maximumTerms : 1));
/* there is no step size in SRU/W ??? */
- wrbuf_printf(wr, "%s: %s ", querytype, querystr);
+ wrbuf_printf(wr, "%s: %s ", srw_req->queryType, srw_req->scanClause);
yaz_log(log_request, "%s ", wrbuf_cstr(wr) );
wrbuf_destroy(wr);
}
{
Z_SRW_searchRetrieveRequest *request = srw_pdu->u.request;
solr_op = "select";
- switch (srw_pdu->u.request->query_type)
- {
- case Z_SRW_query_type_pqf:
- yaz_add_name_value_str(encode, name, value, &i,
- "q", request->query.pqf);
- break;
- case Z_SRW_query_type_cql:
- yaz_add_name_value_str(encode, name, value, &i,
- "q", request->query.cql);
- break;
- default:
+ if (!srw_pdu->u.request->query)
return -1;
- }
+ /* not considering query type here ! */
+ yaz_add_name_value_str(encode, name, value, &i, "q", request->query);
if (srw_pdu->u.request->startRecord)
{
Odr_int start = *request->startRecord - 1;
else if (srw_pdu->which == Z_SRW_scan_request) {
Z_SRW_scanRequest *request = srw_pdu->u.scan_request;
solr_op = "terms";
- switch (srw_pdu->u.scan_request->query_type)
+ if (!srw_pdu->u.scan_request->scanClause)
+ return -1;
+ if (!strcmp(srw_pdu->u.scan_request->queryType, "pqf"))
{
- case Z_SRW_query_type_pqf:
+ yaz_add_name_value_str(encode, name, value, &i,
+ "terms.fl", request->scanClause);
+ yaz_add_name_value_str(encode, name, value, &i,
+ "terms.lower", request->scanClause);
+ }
+ else if (!strcmp(srw_pdu->u.scan_request->queryType, "cql"))
+ {
+ q = request->scanClause;
+ pos = strchr(q, ':');
+ if (pos != NULL) {
yaz_add_name_value_str(encode, name, value, &i,
- "terms.fl", request->scanClause.pqf);
+ "terms.lower", odr_strdup(encode, pos + 1));
+ *pos = '\0';
yaz_add_name_value_str(encode, name, value, &i,
- "terms.lower", request->scanClause.pqf);
- break;
- case Z_SRW_query_type_cql:
- q = request->scanClause.cql;
- pos = strchr(q, ':');
- if (pos != NULL) {
- yaz_add_name_value_str(encode, name, value, &i,
- "terms.lower", odr_strdup(encode, pos + 1));
- *pos = '\0';
- yaz_add_name_value_str(encode, name, value, &i,
- "terms.fl", odr_strdup(encode, q));
- *pos = ':';
- } else {
- yaz_add_name_value_str(encode, name, value, &i,
- "terms.lower", odr_strdup(encode, q));
- }
- break;
- default:
- return -1;
+ "terms.fl", odr_strdup(encode, q));
+ *pos = ':';
+ } else {
+ yaz_add_name_value_str(encode, name, value, &i,
+ "terms.lower", odr_strdup(encode, q));
+ }
}
+ else
+ return -1;
yaz_add_name_value_str(encode, name, value, &i,
"terms.sort", "index");
yaz_add_name_value_int(encode, name, value, &i,
(*p)->which = Z_SRW_searchRetrieve_request;
req = (*p)->u.request = (Z_SRW_searchRetrieveRequest *)
odr_malloc(o, sizeof(*req));
- req->query_type = Z_SRW_query_type_cql;
- req->query.cql = 0;
+ req->queryType = "cql";
+ req->query = 0;
req->sort_type = Z_SRW_sort_type_none;
req->sort.none = 0;
req->startRecord = 0;
if (match_xsd_string(ptr, "version", o,
&(*p)->srw_version))
;
+ else if (match_xsd_string(ptr, "queryType", o,
+ &req->queryType))
+ ;
else if (match_xsd_string(ptr, "query", o,
- &req->query.cql))
- req->query_type = Z_SRW_query_type_cql;
+ &req->query))
+ ;
else if (match_xsd_string(ptr, "pQuery", o,
- &req->query.pqf))
- req->query_type = Z_SRW_query_type_pqf;
+ &req->query))
+ req->queryType = "pqf";
else if (match_xsd_string(ptr, "xQuery", o,
- &req->query.xcql))
- req->query_type = Z_SRW_query_type_xcql;
+ &req->query))
+ req->queryType = "xcql";
else if (match_xsd_integer(ptr, "startRecord", o,
&req->startRecord))
;
else
match_xsd_string(ptr, "database", o, &req->database);
}
- if (!req->query.cql && !req->query.pqf && !req->query.xcql)
+ if (!req->query)
{
/* should put proper diagnostic here */
return -1;
(*p)->which = Z_SRW_scan_request;
req = (*p)->u.scan_request = (Z_SRW_scanRequest *)
odr_malloc(o, sizeof(*req));
- req->query_type = Z_SRW_query_type_cql;
- req->scanClause.cql = 0;
+ req->queryType = "cql";
+ req->scanClause = 0;
req->responsePosition = 0;
req->maximumTerms = 0;
req->stylesheet = 0;
&(*p)->extraResponseData_len))
;
else if (match_xsd_string(ptr, "scanClause", o,
- &req->scanClause.cql))
+ &req->scanClause))
;
else if (match_xsd_string(ptr, "pScanClause", o,
- &req->scanClause.pqf))
+ &req->scanClause))
{
- req->query_type = Z_SRW_query_type_pqf;
+ req->queryType = "pqf";
}
else if (match_xsd_integer(ptr, "responsePosition", o,
&req->responsePosition))
if ((*p)->which == Z_SRW_searchRetrieve_request)
{
Z_SRW_searchRetrieveRequest *req = (*p)->u.request;
+ const char *queryType = req->queryType;
ptr = xmlNewChild(pptr, 0, BAD_CAST "searchRetrieveRequest", 0);
ns_srw = xmlNewNs(ptr, BAD_CAST ns, BAD_CAST "zs");
xmlSetNs(ptr, ns_srw);
if ((*p)->srw_version)
add_xsd_string(ptr, "version", (*p)->srw_version);
- switch (req->query_type)
+
+ if (strcmp((*p)->srw_version, "2.") > 0)
{
- case Z_SRW_query_type_cql:
- add_xsd_string(ptr, "query", req->query.cql);
- break;
- case Z_SRW_query_type_xcql:
- add_xsd_string(ptr, "xQuery", req->query.xcql);
- break;
- case Z_SRW_query_type_pqf:
- add_xsd_string(ptr, "pQuery", req->query.pqf);
- break;
+ if (queryType)
+ add_xsd_string(ptr, "queryType", queryType);
+ add_xsd_string(ptr, "query", req->query);
+ }
+ else
+ {
+ if (!queryType || !strcmp(queryType, "cql"))
+ add_xsd_string(ptr, "query", req->query);
+ else if (!strcmp(queryType, "xcql"))
+ add_xsd_string(ptr, "xQuery", req->query);
+ else if (!strcmp(queryType, "pqf"))
+ add_xsd_string(ptr, "pQuery", req->query);
}
add_xsd_integer(ptr, "startRecord", req->startRecord);
add_xsd_integer(ptr, "maximumRecords", req->maximumRecords);
else if ((*p)->which == Z_SRW_scan_request)
{
Z_SRW_scanRequest *req = (*p)->u.scan_request;
+ const char *queryType = req->queryType;
ptr = xmlNewChild(pptr, 0, BAD_CAST "scanRequest", 0);
ns_srw = xmlNewNs(ptr, BAD_CAST ns, BAD_CAST "zs");
xmlSetNs(ptr, ns_srw);
add_xsd_string(ptr, "version", (*p)->srw_version);
- switch (req->query_type)
+
+ if (strcmp((*p)->srw_version, "2.") > 0)
{
- case Z_SRW_query_type_cql:
- add_xsd_string(ptr, "scanClause", req->scanClause.cql);
- break;
- case Z_SRW_query_type_pqf:
- add_xsd_string(ptr, "pScanClause", req->scanClause.pqf);
- break;
+ if (queryType && strcmp(queryType, "cql"))
+ add_xsd_string(ptr, "queryType", queryType);
+ add_xsd_string(ptr, "scanClause", req->scanClause);
+ }
+ else
+ {
+ if (!queryType || !strcmp(queryType, "cql"))
+ add_xsd_string(ptr, "scanClause", req->scanClause);
+ else if (!strcmp(queryType, "pqf"))
+ add_xsd_string(ptr, "pScanClause", req->scanClause);
}
add_xsd_integer(ptr, "responsePosition", req->responsePosition);
add_xsd_integer(ptr, "maximumTerms", req->maximumTerms);
const char *operation = 0;
char *version = 0;
char *query = 0;
- char *pQuery = 0;
+ char *queryType = "cql";
char *username = 0;
char *password = 0;
char *sortKeys = 0;
char *stylesheet = 0;
char *scanClause = 0;
- char *pScanClause = 0;
char *recordXPath = 0;
char *recordSchema = 0;
char *recordPacking = "xml"; /* xml packing is default for SRU */
if (!strcmp(n, "query"))
query = v;
else if (!strcmp(n, "x-pquery"))
- pQuery = v;
+ {
+ query = v;
+ queryType = "pqf";
+ }
+ else if (!strcmp(n, "queryType"))
+ queryType = v;
else if (!strcmp(n, "x-username"))
username = v;
else if (!strcmp(n, "x-password"))
else if (!strcmp(n, "scanClause"))
scanClause = v;
else if (!strcmp(n, "x-pScanClause"))
- pScanClause = v;
+ {
+ scanClause = v;
+ queryType = "pqf";
+ }
else if (!strcmp(n, "maximumRecords"))
maximumRecords = v;
else if (!strcmp(n, "startRecord"))
sr->extra_args = extra_args;
*srw_pdu = sr;
yaz_srw_decodeauth(sr, hreq, username, password, decode);
- if (query)
- {
- sr->u.request->query_type = Z_SRW_query_type_cql;
- sr->u.request->query.cql = query;
- }
- else if (pQuery)
- {
- sr->u.request->query_type = Z_SRW_query_type_pqf;
- sr->u.request->query.pqf = pQuery;
- }
- else
+
+ sr->u.request->queryType = queryType;
+ sr->u.request->query = query;
+
+ if (!query)
yaz_add_srw_diagnostic(
decode, diag, num_diag,
YAZ_SRW_MANDATORY_PARAMETER_NOT_SUPPLIED, "query");
*srw_pdu = sr;
yaz_srw_decodeauth(sr, hreq, username, password, decode);
- if (scanClause)
- {
- sr->u.scan_request->query_type = Z_SRW_query_type_cql;
- sr->u.scan_request->scanClause.cql = scanClause;
- }
- else if (pScanClause)
- {
- sr->u.scan_request->query_type = Z_SRW_query_type_pqf;
- sr->u.scan_request->scanClause.pqf = pScanClause;
- }
- else
+ sr->u.scan_request->queryType = queryType;
+ sr->u.scan_request->scanClause = scanClause;
+
+ if (!scanClause)
yaz_add_srw_diagnostic(
decode, diag, num_diag,
YAZ_SRW_MANDATORY_PARAMETER_NOT_SUPPLIED, "scanClause");
case Z_SRW_searchRetrieve_request:
sr->u.request = (Z_SRW_searchRetrieveRequest *)
odr_malloc(o, sizeof(*sr->u.request));
- sr->u.request->query_type = Z_SRW_query_type_cql;
- sr->u.request->query.cql = 0;
+ sr->u.request->queryType = "cql";
+ sr->u.request->query = 0;
sr->u.request->sort_type = Z_SRW_sort_type_none;
sr->u.request->sort.none = 0;
sr->u.request->startRecord = 0;
sr->u.scan_request->stylesheet = 0;
sr->u.scan_request->maximumTerms = 0;
sr->u.scan_request->responsePosition = 0;
- sr->u.scan_request->query_type = Z_SRW_query_type_cql;
- sr->u.scan_request->scanClause.cql = 0;
+ sr->u.scan_request->queryType = "cql";
+ sr->u.scan_request->scanClause = 0;
break;
case Z_SRW_scan_response:
sr->u.scan_response = (Z_SRW_scanResponse *)
char **name, char **value, int max_names)
{
int i = 0;
+ char *queryType;
yaz_add_name_value_str(encode, name, value, &i, "version", srw_pdu->srw_version);
name[i] = "operation";
- switch(srw_pdu->which)
+ switch (srw_pdu->which)
{
case Z_SRW_searchRetrieve_request:
value[i++] = "searchRetrieve";
- switch(srw_pdu->u.request->query_type)
+ queryType = srw_pdu->u.request->queryType;
+ if (strcmp(srw_pdu->srw_version, "2.") > 0)
{
- case Z_SRW_query_type_cql:
+ yaz_add_name_value_str(encode, name, value, &i, "queryType",
+ queryType);
yaz_add_name_value_str(encode, name, value, &i, "query",
- srw_pdu->u.request->query.cql);
- break;
- case Z_SRW_query_type_pqf:
- yaz_add_name_value_str(encode, name, value, &i, "x-pquery",
- srw_pdu->u.request->query.pqf);
- break;
- case Z_SRW_query_type_xcql:
- yaz_add_name_value_str(encode, name, value, &i, "x-cql",
- srw_pdu->u.request->query.xcql);
- break;
+ srw_pdu->u.request->query);
+ }
+ else
+ {
+ if (!strcmp(queryType, "cql"))
+ {
+ yaz_add_name_value_str(encode, name, value, &i, "query",
+ srw_pdu->u.request->query);
+ }
+ else if (!strcmp(queryType, "pqf"))
+ {
+ yaz_add_name_value_str(encode, name, value, &i, "x-pquery",
+ srw_pdu->u.request->query);
+ }
+ else if (!strcmp(queryType, "pqf"))
+ {
+ yaz_add_name_value_str(encode, name, value, &i, "x-cql",
+ srw_pdu->u.request->query);
+ }
}
- switch(srw_pdu->u.request->sort_type)
+ switch (srw_pdu->u.request->sort_type)
{
case Z_SRW_sort_type_none:
break;
break;
case Z_SRW_scan_request:
value[i++] = "scan";
-
- switch(srw_pdu->u.scan_request->query_type)
+ queryType = srw_pdu->u.request->queryType;
+ if (strcmp(srw_pdu->srw_version, "2.") > 0)
{
- case Z_SRW_query_type_cql:
- yaz_add_name_value_str(encode, name, value, &i, "scanClause",
- srw_pdu->u.scan_request->scanClause.cql);
- break;
- case Z_SRW_query_type_pqf:
- yaz_add_name_value_str(encode, name, value, &i, "x-pScanClause",
- srw_pdu->u.scan_request->scanClause.pqf);
- break;
- case Z_SRW_query_type_xcql:
- yaz_add_name_value_str(encode, name, value, &i, "x-cqlScanClause",
- srw_pdu->u.scan_request->scanClause.xcql);
- break;
+ if (queryType && strcmp(queryType, "cql"))
+ yaz_add_name_value_str(encode, name, value, &i, "queryType",
+ queryType);
+ yaz_add_name_value_str(encode, name, value, &i, "query",
+ srw_pdu->u.request->query);
+ }
+ else
+ {
+ if (!queryType || !strcmp(queryType, "cql"))
+ yaz_add_name_value_str(encode, name, value, &i, "scanClause",
+ srw_pdu->u.scan_request->scanClause);
+ else if (!strcmp(queryType, "pqf"))
+ yaz_add_name_value_str(encode, name, value, &i, "x-pScanClause",
+ srw_pdu->u.scan_request->scanClause);
+ else if (!strcmp(queryType, "xcql"))
+ yaz_add_name_value_str(encode, name, value, &i,
+ "x-cqlScanClause",
+ srw_pdu->u.scan_request->scanClause);
}
yaz_add_name_value_int(encode, name, value, &i, "responsePosition",
srw_pdu->u.scan_request->responsePosition);
/* SRU scan can only carry CQL and PQF */
if (z_query->which == Z_Query_type_104)
{
- sr->u.scan_request->query_type = Z_SRW_query_type_cql;
- sr->u.scan_request->scanClause.cql =
+ sr->u.scan_request->queryType = "cql";
+ sr->u.scan_request->scanClause =
odr_strdup(c->odr_out, ZOOM_query_get_query_string(scan->query));
}
else if (z_query->which == Z_Query_type_1
|| z_query->which == Z_Query_type_101)
{
- sr->u.scan_request->query_type = Z_SRW_query_type_pqf;
- sr->u.scan_request->scanClause.pqf =
+ sr->u.scan_request->queryType = "pqf";
+ sr->u.scan_request->scanClause =
odr_strdup(c->odr_out, ZOOM_query_get_query_string(scan->query));
}
else
if (z_query->which == Z_Query_type_104
&& z_query->u.type_104->which == Z_External_CQL)
{
- sr->u.request->query_type = Z_SRW_query_type_cql;
- sr->u.request->query.cql = z_query->u.type_104->u.cql;
+ sr->u.request->queryType = "cql";
+ sr->u.request->query = z_query->u.type_104->u.cql;
}
else if (z_query->which == Z_Query_type_1 && z_query->u.type_1)
{
- sr->u.request->query_type = Z_SRW_query_type_pqf;
- sr->u.request->query.pqf =
+ sr->u.request->queryType = "pqf";
+ sr->u.request->query =
odr_strdup(c->odr_out,
ZOOM_query_get_query_string(resultset->query));
}
if (sr->which == Z_SRW_searchRetrieve_request)
{
Z_SRW_searchRetrieveRequest *req = sr->u.request;
- switch(req->query_type)
- {
- case Z_SRW_query_type_cql:
- fprintf(stderr, "CQL: %s\n", req->query.cql);
- break;
- case Z_SRW_query_type_xcql:
- fprintf(stderr, "XCQL\n");
- break;
- case Z_SRW_query_type_pqf:
- fprintf(stderr, "PQF: %s\n", req->query.pqf);
- break;
- }
+ fprintf(stderr, "%s: %s\n", req->queryType, req->query);
}
else if (sr->which == Z_SRW_searchRetrieve_response)
{