From: Adam Dickmeiss Date: Sun, 6 Jan 2008 19:34:34 +0000 (+0000) Subject: CQL free-form terms are ANDed (extra terms). X-Git-Tag: YAZ.3.0.20~16 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=45754b01d18ddee3e71b79d6be871cc75c2c7c86 CQL free-form terms are ANDed (extra terms). CQL free-form terms are ANDed in the CQL to PQF conversion. For example, dc.title = a b, means dc.title = a and dc.title = b. And the query (a "b c") means (a and "b c"). This might be configurable in a future version of the conversion. This does not alter semantics for non-free form term queries, e.g. dc.title=a . --- diff --git a/src/cqltransform.c b/src/cqltransform.c index fa7da0e..35e4219 100644 --- a/src/cqltransform.c +++ b/src/cqltransform.c @@ -1,4 +1,4 @@ -/* $Id: cqltransform.c,v 1.31 2008-01-06 13:08:09 adam Exp $ +/* $Id: cqltransform.c,v 1.32 2008-01-06 19:34:34 adam Exp $ Copyright (C) 1995-2007, Index Data ApS Index Data Aps @@ -517,6 +517,34 @@ void emit_term(cql_transform_t ct, xfree(z3958_mem); } +void emit_terms(cql_transform_t ct, + struct cql_node *cn, + void (*pr)(const char *buf, void *client_data), + void *client_data, + const char *op) +{ + struct cql_node *ne = cn->u.st.extra_terms; + if (ne) + { + (*pr)("@", client_data); + (*pr)(op, client_data); + (*pr)(" ", client_data); + } + emit_term(ct, cn, cn->u.st.term, strlen(cn->u.st.term), + pr, client_data); + for (; ne; ne = ne->u.st.extra_terms) + { + if (ne->u.st.extra_terms) + { + (*pr)("@", client_data); + (*pr)(op, client_data); + (*pr)(" ", client_data); + } + emit_term(ct, cn, ne->u.st.term, strlen(ne->u.st.term), + pr, client_data); + } +} + void emit_wordlist(cql_transform_t ct, struct cql_node *cn, void (*pr)(const char *buf, void *client_data), @@ -597,8 +625,7 @@ void cql_transform_r(cql_transform_t ct, } else { - emit_term(ct, cn, cn->u.st.term, strlen(cn->u.st.term), - pr, client_data); + emit_terms(ct, cn, pr, client_data, "and"); } break; case CQL_NODE_BOOL: