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);
{
size_t i;
int must_quote = 0;
+
for (i = 0 ; i < lterm; i++)
if (sterm[i] == ' ')
must_quote = 1;
/* 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, "*");
*/
/**
* \file solr.c
- * \brief Implements SOAP Webservice decoding/encoding
+ * \brief Implements Solr decoding/encoding
*/
#if HAVE_CONFIG_H
#include <config.h>
}
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";
};
-/* 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);
}
}
-/* Utillity functions end */
+/* Utility functions end */
solr_transform_t solr_transform_create(void)
{
#include <yaz/yaz-iconv.h>
#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);
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);
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);