From df43df1a412b098478f0909e13430c3262c1e1c3 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 20 May 2005 19:29:18 +0000 Subject: [PATCH] Added support for SRW sort in Generic Frontend Server. Patch by Ko van der Sloot. Member srw_sortKeys in bend_search_rr holds sortKeys - or NULL if none is provided. --- NEWS | 4 ++++ include/yaz/backend.h | 3 ++- src/seshigh.c | 15 ++++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 4855538..fe05bc6 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ Possible compatibility problems with earlier versions marked with '*'. +Added support for SRW sort in Generic Frontend Server. Patch +by Ko van der Sloot. Member srw_sortKeys in bend_search_rr holds +sortKeys - or NULL if none is provided. + Fixed bug #307: It was impossible to specify indefinite/no timeout for ZOOM_event. Special timeout value -1 now means indefinite timeout (i.e. no timeout). diff --git a/include/yaz/backend.h b/include/yaz/backend.h index e05b8e1..1d56e06 100644 --- a/include/yaz/backend.h +++ b/include/yaz/backend.h @@ -23,7 +23,7 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * - * $Id: backend.h,v 1.30 2005-03-03 23:16:20 adam Exp $ + * $Id: backend.h,v 1.31 2005-05-20 19:29:18 adam Exp $ */ /** @@ -64,6 +64,7 @@ typedef struct { int errcode; /* 0==OK */ char *errstring; /* system error string or NULL */ Z_OtherInformation *search_info; /* additional search info */ + char *srw_sortKeys; /* holds SRU/SRW sortKeys info */ } bend_search_rr; /* extended present handler. Does not replace bend_fetch. */ diff --git a/src/seshigh.c b/src/seshigh.c index a445b18..34510ab 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: seshigh.c,v 1.55 2005-05-11 12:07:48 adam Exp $ + * $Id: seshigh.c,v 1.56 2005-05-20 19:29:18 adam Exp $ */ /** * \file seshigh.c @@ -713,11 +713,7 @@ static void srw_bend_search(association *assoc, request *req, *http_code = 200; yaz_log(log_requestdetail, "Got SRW SearchRetrieveRequest"); srw_bend_init(assoc, &srw_res->diagnostics, &srw_res->num_diagnostics); - if (srw_req->sort_type != Z_SRW_sort_type_none) - yaz_add_srw_diagnostic(assoc->encode, &srw_res->diagnostics, - &srw_res->num_diagnostics, - YAZ_SRW_SORT_UNSUPP, 0); - else if (srw_res->num_diagnostics == 0 && assoc->init) + if (srw_res->num_diagnostics == 0 && assoc->init) { bend_search_rr rr; rr.setname = "default"; @@ -725,6 +721,7 @@ static void srw_bend_search(association *assoc, request *req, rr.num_bases = 1; rr.basenames = &srw_req->database; rr.referenceId = 0; + rr.srw_sortKeys = 0; rr.query = (Z_Query *) odr_malloc (assoc->decode, sizeof(*rr.query)); rr.query->u.type_1 = 0; @@ -794,6 +791,9 @@ static void srw_bend_search(association *assoc, request *req, rr.decode = assoc->decode; rr.print = assoc->print; rr.request = req; + if ( srw_req->sort.sortKeys ) + rr.srw_sortKeys = odr_strdup(assoc->encode, + srw_req->sort.sortKeys ); rr.association = assoc; rr.fd = 0; rr.hits = 0; @@ -1764,7 +1764,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) assoc->init->implementation_name, odr_prepend(assoc->encode, "GFS", resp->implementationName)); - version = odr_strdup(assoc->encode, "$Revision: 1.55 $"); + version = odr_strdup(assoc->encode, "$Revision: 1.56 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; resp->implementationVersion = odr_prepend(assoc->encode, @@ -2007,6 +2007,7 @@ static Z_APDU *process_searchRequest(association *assoc, request *reqb, bsrr->association = assoc; bsrr->referenceId = req->referenceId; save_referenceId (reqb, bsrr->referenceId); + bsrr->srw_sortKeys = 0; yaz_log (log_requestdetail, "ResultSet '%s'", req->resultSetName); if (req->databaseNames) -- 1.7.10.4