/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2013 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
/**
#include <libxml/tree.h>
#endif
+#include <yaz/facet.h>
#include <yaz/xmalloc.h>
#include <yaz/comstack.h>
#include "eventl.h"
if (r)
{
rr->errcode = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
+ rr->surrogate_flag = 1;
if (details)
rr->errstring = odr_strdup(rr->stream, details);
}
rr.errstring = 0;
rr.search_info = 0;
rr.search_input = 0;
+
+ if (srw_req->facetList)
+ yaz_oi_set_facetlist(&rr.search_input, assoc->encode,
+ srw_req->facetList);
+
yaz_log_zquery_level(log_requestdetail,rr.query);
(assoc->init->bend_search)(assoc->backend, &rr);
odr_intdup(assoc->encode, *rr.srw_setnameIdleTime );
}
+ srw_res->facetList = yaz_oi_get_facetlist(&rr.search_info);
if (start > rr.hits || start < 1)
{
/* if hits<=0 and start=1 we don't return a diagnostic */
res->extraResponseData_buf = rr.extra_response_data;
res->extraResponseData_len = strlen(rr.extra_response_data);
}
- if (rr.estimated_hit_count || rr.partial_resultset)
+ if (strcmp(res->srw_version, "2.") > 0)
+ {
+ if (rr.estimated_hit_count)
+ srw_res->resultCountPrecision =
+ odr_strdup(assoc->encode, "estimate");
+ else if (rr.partial_resultset)
+ srw_res->resultCountPrecision =
+ odr_strdup(assoc->encode, "minimum");
+ else
+ srw_res->resultCountPrecision =
+ odr_strdup(assoc->encode, "exact");
+ }
+ else if (rr.estimated_hit_count || rr.partial_resultset)
{
yaz_add_srw_diagnostic(
assoc->encode,
{
Z_SRW_explainRequest *srw_req = sr->u.explain_request;
yaz_log(log_requestdetail, "Got SRW ExplainRequest");
- *http_code = 404;
srw_bend_init(assoc, &srw_res->diagnostics, &srw_res->num_diagnostics, sr);
+ if (!assoc->init && srw_res->num_diagnostics == 0)
+ *http_code = 404;
if (assoc->init)
{
bend_explain_rr rr;
Z_SRW_updateRequest *srw_req = sr->u.update_request;
yaz_log(log_session, "SRWUpdate action=%s", srw_req->operation);
yaz_log(YLOG_DEBUG, "num_diag = %d", srw_res->num_diagnostics );
- *http_code = 404;
srw_bend_init(assoc, &srw_res->diagnostics, &srw_res->num_diagnostics, sr);
+ if (!assoc->init && srw_res->num_diagnostics == 0)
+ *http_code = 404;
if (assoc->init)
{
bend_update_rr rr;
hres->code = http_code;
strcpy(ctype, "text/xml");
- if (charset && strlen(charset) < sizeof(ctype)-30)
- {
- strcat(ctype, "; charset=");
- strcat(ctype, charset);
- }
z_HTTP_header_add(o, &hres->headers, "Content-Type", ctype);
}
else
bsrr->errcode = 0;
bsrr->errstring = NULL;
bsrr->search_info = NULL;
- bsrr->search_input = req->otherInfo;
+ bsrr->search_input = req->additionalSearchInfo;
+ if (!bsrr->search_input)
+ bsrr->search_input = req->otherInfo;
bsrr->present_number = *req->mediumSetPresentNumber;
if (assoc->server && assoc->server->cql_transform
{
Z_Entry *e;
Z_TermInfo *t;
- Odr_oct *o;
tab[i] = e = (Z_Entry *)odr_malloc(assoc->encode, sizeof(*e));
if (bsrr->entries[i].occurrences >= 0)
t->term = (Z_Term *)
odr_malloc(assoc->encode, sizeof(*t->term));
t->term->which = Z_Term_general;
- t->term->u.general = o =
- (Odr_oct *)odr_malloc(assoc->encode, sizeof(Odr_oct));
- o->buf = (unsigned char *)
- odr_malloc(assoc->encode, o->len = o->size =
- strlen(bsrr->entries[i].term));
- memcpy(o->buf, bsrr->entries[i].term, o->len);
+ t->term->u.general =
+ odr_create_Odr_oct(assoc->encode,
+ bsrr->entries[i].term,
+ strlen(bsrr->entries[i].term));
yaz_log(YLOG_DEBUG, " term #%d: '%s' (" ODR_INT_PRINTF ")", i,
bsrr->entries[i].term, bsrr->entries[i].occurrences);
}