X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ffilter_sru_to_z3950.cpp;h=3e050ef3cc2f69a09f8760d4a543d7f554b1ffa5;hb=b02df3fd0849c5222081013420c18f949c55f9c5;hp=06305bb6d9d696247300181b296e26a7882eeabd;hpb=3f4bd901440c6f15c3468cd46a34993d7a2d8571;p=metaproxy-moved-to-github.git diff --git a/src/filter_sru_to_z3950.cpp b/src/filter_sru_to_z3950.cpp index 06305bb..3e050ef 100644 --- a/src/filter_sru_to_z3950.cpp +++ b/src/filter_sru_to_z3950.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2013 Index Data + Copyright (C) Index Data Metaproxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -30,6 +30,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include +#if YAZ_VERSIONL >= 0x50000 +#include +#endif #include #include @@ -597,6 +600,14 @@ bool yf::SRUtoZ3950::Impl::z3950_search_request(mp::Package &package, odr_malloc(odr_en, sizeof(char *)); z_searchRequest->databaseNames[0] = odr_strdup(odr_en, db.c_str()); } +#if YAZ_VERSIONL >= 0x50000 + // yaz_oi_set_facetlist not public in YAZ 4.2.66 + if (sr_req->facetList) + { + Z_OtherInformation **oi = &z_searchRequest->otherInfo; + yaz_oi_set_facetlist(oi, odr_en, sr_req->facetList); + } +#endif Z_Query *z_query = (Z_Query *) odr_malloc(odr_en, sizeof(Z_Query)); z_searchRequest->query = z_query; @@ -637,7 +648,12 @@ bool yf::SRUtoZ3950::Impl::z3950_search_request(mp::Package &package, { return false; } - +#if YAZ_VERSIONL >= 0x50000 + Z_FacetList *fl = yaz_oi_get_facetlist(&sr->additionalSearchInfo); + if (!fl) + fl = yaz_oi_get_facetlist(&sr->otherInfo); + sru_pdu_res->u.response->facetList = fl; +#endif sru_pdu_res->u.response->numberOfRecords = odr_intdup(odr_en, *sr->resultCount); return true; @@ -869,7 +885,13 @@ int yf::SRUtoZ3950::Impl::z3950_build_query( const Z_SRW_searchRetrieveRequest *req ) const { - if (req->query_type == Z_SRW_query_type_cql) + if ( +#ifdef Z_SRW_query_type_cql + req->query_type == Z_SRW_query_type_cql +#else + !strcmp(req->queryType, "cql") +#endif + ) { Z_External *ext = (Z_External *) odr_malloc(odr_en, sizeof(*ext)); @@ -878,22 +900,39 @@ int yf::SRUtoZ3950::Impl::z3950_build_query( ext->indirect_reference = 0; ext->descriptor = 0; ext->which = Z_External_CQL; - ext->u.cql = odr_strdup(odr_en, req->query.cql); + ext->u.cql = odr_strdup(odr_en, +#ifdef Z_SRW_query_type_cql + req->query.cql +#else + req->query +#endif + ); z_query->which = Z_Query_type_104; z_query->u.type_104 = ext; return 0; } - if (req->query_type == Z_SRW_query_type_pqf) + if ( +#ifdef Z_SRW_query_type_pqf + req->query_type == Z_SRW_query_type_pqf +#else + !strcmp(req->queryType, "pqf") +#endif + ) { Z_RPNQuery *RPNquery; YAZ_PQF_Parser pqf_parser; pqf_parser = yaz_pqf_create (); - RPNquery = yaz_pqf_parse (pqf_parser, odr_en, req->query.pqf); - + RPNquery = yaz_pqf_parse (pqf_parser, odr_en, +#ifdef Z_SRW_query_type_pqf + req->query.pqf +#else + req->query +#endif + ); yaz_pqf_destroy(pqf_parser); if (!RPNquery)