X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fsolr.c;h=c1c1bbadfee72b2f869070d66f5e332cb0169b96;hp=73950b4a9c59ae09435139bfc3da7f699d51faa7;hb=01e36a11adc97a240cc595f89280c8a619770251;hpb=1932238af8876622f567da122fb52fb3791c9514 diff --git a/src/solr.c b/src/solr.c index 73950b4..c1c1bba 100644 --- a/src/solr.c +++ b/src/solr.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. */ /** @@ -18,6 +18,7 @@ #include #include #include +#include #include "sru-p.h" @@ -153,7 +154,7 @@ Z_FacetField *yaz_solr_decode_facet_field(ODR o, xmlNodePtr ptr, xmlNodePtr node; // USE attribute const char* name = yaz_element_attribute_value_get(ptr, "lst", "name"); - list = yaz_use_attribute_create(o, name); + list = zget_AttributeList_use_string(o, name); for (node = ptr->children; node; node = node->next) num_terms++; facet_field = facet_field_create(o, list, num_terms); @@ -482,6 +483,7 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, char *q; char *pos; char *cp; + const char *path_args = 0; int i = 0; z_HTTP_header_add_basic_auth(encode, &hreq->headers, @@ -580,8 +582,17 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, path = (char *) odr_malloc(encode, strlen(hreq->path) + - strlen(uri_args) + strlen(solr_op) + 4); + strlen(uri_args) + strlen(solr_op) + 5); + cp = strchr(hreq->path, '#'); + if (cp) + *cp = '\0'; + cp = strchr(hreq->path, '?'); + if (cp) + { + *cp = '\0'; /* args in path */ + path_args = cp + 1; + } strcpy(path, hreq->path); cp = strrchr(path, '/'); if (cp) @@ -592,6 +603,11 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, strcat(path, "/"); strcat(path, solr_op); strcat(path, "?"); + if (path_args) + { + strcat(path, path_args); + strcat(path, "&"); + } strcat(path, uri_args); hreq->path = path;