From: Adam Dickmeiss Date: Fri, 15 Jul 2011 19:14:41 +0000 (+0200) Subject: Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz X-Git-Tag: v4.2.8~18 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=4a7e5fa76ce41e82c7e028aea763bcf63cd0237b;hp=3b048412a86f31a520c83d8604569c88ec9cbbf6 Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz --- diff --git a/src/cql2ccl.c b/src/cql2ccl.c index f427e7c..4a3932e 100644 --- a/src/cql2ccl.c +++ b/src/cql2ccl.c @@ -133,15 +133,19 @@ static int bool(struct cql_node *cn, void (*pr)(const char *buf, void *client_data), void *client_data) { + char *value = cn->u.boolean.value; int r; + /* Rather lame initial attempt at interpreting proximity */ + if (!strcmp(value, "prox")) value = "!"; + pr("(", client_data); r = cql_to_ccl_r(cn->u.boolean.left, pr, client_data); if (r) return r; pr(" ", client_data); - pr(cn->u.boolean.value, client_data); + pr(value, client_data); pr(" ", client_data); r = cql_to_ccl_r(cn->u.boolean.right, pr, client_data); diff --git a/src/rpn2solr.c b/src/rpn2solr.c index 89b8b91..70b2f6c 100644 --- a/src/rpn2solr.c +++ b/src/rpn2solr.c @@ -245,6 +245,7 @@ static int rpn2solr_simple(solr_transform_t ct, { size_t i; int must_quote = 0; + for (i = 0 ; i < lterm; i++) if (sterm[i] == ' ') must_quote = 1; @@ -253,7 +254,13 @@ static int rpn2solr_simple(solr_transform_t ct, /* Bug 2878: Check and add Truncation */ if (checkForLeftTruncation(apt->attributes)) wrbuf_puts(w, "*"); - wrbuf_write(w, sterm, lterm); + for (i = 0 ; i < lterm; i++) { + /* BUG 4415: Escape special characters in string terms */ + if (strchr("+-&|!(){}[]^\"~*?:\\", sterm[i])) { + wrbuf_putc(w, '\\'); + } + wrbuf_putc(w, sterm[i]); + } /* Bug 2878: Check and add Truncation */ if (checkForRightTruncation(apt->attributes)) wrbuf_puts(w, "*"); diff --git a/src/solr.c b/src/solr.c index 701e9f3..28b8f11 100644 --- a/src/solr.c +++ b/src/solr.c @@ -4,7 +4,7 @@ */ /** * \file solr.c - * \brief Implements SOAP Webservice decoding/encoding + * \brief Implements Solr decoding/encoding */ #if HAVE_CONFIG_H #include @@ -356,7 +356,20 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, } else return -1; - name[i] = 0; + + if (srw_pdu->extra_args) + { + Z_SRW_extra_arg *ea = srw_pdu->extra_args; + for (; ea && i < SOLR_MAX_PARAMETERS; ea = ea->next) + { + name[i] = ea->name; + value[i] = ea->value; + i++; + } + } + + name[i++] = 0; + yaz_array_to_uri(&uri_args, encode, name, value); hreq->method = "GET"; diff --git a/src/solrtransform.c b/src/solrtransform.c index 4ce5a95..11843db 100644 --- a/src/solrtransform.c +++ b/src/solrtransform.c @@ -41,7 +41,7 @@ struct solr_transform_t_ { }; -/* TODO Utility functions, evt. split out int separate file */ +/* TODO Utility functions, split out into separate file */ int solr_strcmp(const char *s1, const char *s2) { return cql_strcmp(s1, s2); } @@ -70,7 +70,7 @@ void solr_buf_write_handler (const char *b, void *client_data) } -/* Utillity functions end */ +/* Utility functions end */ solr_transform_t solr_transform_create(void) { diff --git a/src/srwutil.c b/src/srwutil.c index 6f54b29..9eff9aa 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -17,6 +17,8 @@ #include #include "sru-p.h" +#define MAX_SRU_PARAMETERS 30 + static char *yaz_decode_sru_dbpath_odr(ODR n, const char *uri, size_t len) { return odr_strdupn(n, uri, len); @@ -1223,13 +1225,13 @@ static int yaz_get_sru_parms(const Z_SRW_PDU *srw_pdu, ODR encode, int yaz_sru_get_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, ODR encode, const char *charset) { - char *name[30], *value[30]; /* definite upper limit for SRU params */ + char *name[MAX_SRU_PARAMETERS], *value[MAX_SRU_PARAMETERS]; /* definite upper limit for SRU params */ char *uri_args; char *path; z_HTTP_header_add_basic_auth(encode, &hreq->headers, srw_pdu->username, srw_pdu->password); - if (yaz_get_sru_parms(srw_pdu, encode, name, value, 30)) + if (yaz_get_sru_parms(srw_pdu, encode, name, value, MAX_SRU_PARAMETERS)) return -1; yaz_array_to_uri(&uri_args, encode, name, value); @@ -1250,12 +1252,12 @@ int yaz_sru_get_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, int yaz_sru_post_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, ODR encode, const char *charset) { - char *name[30], *value[30]; /* definite upper limit for SRU params */ + char *name[MAX_SRU_PARAMETERS], *value[MAX_SRU_PARAMETERS]; /* definite upper limit for SRU params */ char *uri_args; z_HTTP_header_add_basic_auth(encode, &hreq->headers, srw_pdu->username, srw_pdu->password); - if (yaz_get_sru_parms(srw_pdu, encode, name, value, 30)) + if (yaz_get_sru_parms(srw_pdu, encode, name, value, MAX_SRU_PARAMETERS)) return -1; yaz_array_to_uri(&uri_args, encode, name, value);