X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fsolr.c;h=6583c18c2dcaf0d39c26d2d790ed25c2b0452e08;hp=e3b8e2659c44e13aa2b5eac5fc4c08fe76b1001e;hb=eb556013557ef8c9e76c52614f88c059ec443c95;hpb=25235a16bedf28aeb6e1129bcaef77d42090124e diff --git a/src/solr.c b/src/solr.c index e3b8e26..6583c18 100644 --- a/src/solr.c +++ b/src/solr.c @@ -475,6 +475,7 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, char *cp; const char *path_args = 0; int i = 0; + int defType_set = 0; int no_parms = 20; /* safe upper limit of args without extra_args */ Z_SRW_extra_arg *ea; @@ -492,6 +493,8 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, for (ea = srw_pdu->extra_args; ea; ea = ea->next) { name[i] = ea->name; + if (!strcmp(ea->name, "defType")) + defType_set = 1; value[i] = ea->value; i++; } @@ -504,7 +507,9 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, solr_op = "select"; if (!srw_pdu->u.request->query) return -1; - /* lucene is the default queryType */ + if (!defType_set) + yaz_add_name_value_str(encode, name, value, &i, "defType", + "lucene"); yaz_add_name_value_str(encode, name, value, &i, "q", request->query); if (srw_pdu->u.request->startRecord) { @@ -611,9 +616,6 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, } strcat(path, uri_args); hreq->path = path; - - z_HTTP_header_add_content_type(encode, &hreq->headers, - "text/xml", charset); return 0; }