X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fcql2ccl.c;h=d08536f20c17a3c13716f104b01b2ccc8bbf85f5;hp=331b6dbfc14e23bba0664bed14681e595d118023;hb=d1b8a1c1647ebb00401f6b6e8f992cca7480b5f9;hpb=9084e20f4c5ffad9cfea2087396206b75a3a6654 diff --git a/src/cql2ccl.c b/src/cql2ccl.c index 331b6db..d08536f 100644 --- a/src/cql2ccl.c +++ b/src/cql2ccl.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2013 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ /** @@ -91,7 +91,6 @@ static int node(struct cql_node *cn, const char *split_op = 0; const char *ccl_rel = 0; const char *rel = cn->u.st.relation; - const char *cp; if (cn->u.st.index && strcmp(cn->u.st.index, "cql.serverChoice")) @@ -122,26 +121,38 @@ static int node(struct cql_node *cn, /* unsupported relation */ return -1; } - cp = cn->u.st.term; - while (1) + for (; cn; cn = cn->u.st.extra_terms) { - if (ccl_field && ccl_rel) + const char *cp = cn->u.st.term; + while (1) { - pr(ccl_field, client_data); - pr(ccl_rel, client_data); - if (!split_op) - ccl_rel = 0; + if (ccl_field && ccl_rel) + { + pr(ccl_field, client_data); + pr(ccl_rel, client_data); + if (!split_op) + ccl_rel = 0; + } + pr_term(&cp, split_op ? 1 : 0, pr, client_data); + while (*cp == ' ') + cp++; + if (*cp == '\0') + break; + pr(" ", client_data); + if (split_op) + { + pr(split_op, client_data); + pr(" ", client_data); + } } - pr_term(&cp, split_op ? 1 : 0, pr, client_data); - while (*cp == ' ') - cp++; - if (*cp == '\0') - break; - pr(" ", client_data); - if (split_op) + if (cn->u.st.extra_terms) { - pr(split_op, client_data); pr(" ", client_data); + if (split_op) + { + pr(split_op, client_data); + pr(" ", client_data); + } } } return 0;