X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=include%2Fyaz%2Fsrw.h;h=9dfc82ba6bfe7a6ea4c9c4f2e8e09d84fcb31507;hb=1331fd610a8bfc1e5a849d2c4d598c11557a8372;hp=9c8c2c130476a33f2acfbf8ed9f9df02a7b49457;hpb=54dc5b4629da5b10c2f3d4e3bdb7cb70c46669a5;p=yaz-moved-to-github.git diff --git a/include/yaz/srw.h b/include/yaz/srw.h index 9c8c2c1..9dfc82b 100644 --- a/include/yaz/srw.h +++ b/include/yaz/srw.h @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2009 Index Data. + * Copyright (C) 1995-2013 Index Data. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -37,6 +37,7 @@ #include #include #include +#include "facet.h" YAZ_BEGIN_CDECL @@ -62,18 +63,11 @@ typedef struct { char *details; char *message; } Z_SRW_diagnostic; - + typedef struct { -#define Z_SRW_query_type_cql 1 -#define Z_SRW_query_type_xcql 2 -#define Z_SRW_query_type_pqf 3 - int query_type; - union { - char *cql; - char *xcql; - char *pqf; - } query; + char *queryType; + char *query; #define Z_SRW_sort_type_none 1 #define Z_SRW_sort_type_sort 2 @@ -92,13 +86,14 @@ typedef struct { char *database; char *stylesheet; Odr_int *resultSetTTL; + Z_FacetList *facetList; } Z_SRW_searchRetrieveRequest; typedef struct { Odr_int *numberOfRecords; char * resultSetId; Odr_int *resultSetIdleTime; - + Z_SRW_record *records; int num_records; @@ -107,6 +102,8 @@ typedef struct { Odr_int *nextRecordPosition; Z_SRW_extra_record **extra_records; /* of size num_records */ + Z_FacetList *facetList; + char *suggestions; } Z_SRW_searchRetrieveResponse; typedef struct { @@ -121,14 +118,10 @@ typedef struct { int num_diagnostics; Z_SRW_extra_record *extra_record; } Z_SRW_explainResponse; - + typedef struct { - int query_type; - union { - char *cql; - char *xcql; - char *pqf; - } scanClause; + char *queryType; + char *scanClause; Odr_int *responsePosition; Odr_int *maximumTerms; char *stylesheet; @@ -266,20 +259,32 @@ YAZ_EXPORT void yaz_decode_uri_component(char *dst, const char *uri, YAZ_EXPORT int yaz_srw_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, Z_SOAP **soap_package, ODR decode, char **charset); + YAZ_EXPORT int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, - Z_SOAP **soap_package, ODR decode, + Z_SOAP **soap_package, ODR decode, char **charset, Z_SRW_diagnostic **, int *num_diagnostic); +/** \brief decode SOLR response (HTTP) + \param o ODR for result + \param hres HTTP response to be decoded + \param pdup SRW response pointer (set if successful) + \retval -1 fail + \retval 0 OK +*/ +YAZ_EXPORT int yaz_solr_decode_response(ODR o, Z_HTTP_Response *hres, + Z_SRW_PDU **pdup); + + YAZ_EXPORT void yaz_add_srw_diagnostic(ODR o, Z_SRW_diagnostic **d, int *num, int code, const char *addinfo); - + YAZ_EXPORT void yaz_add_sru_update_diagnostic(ODR o, Z_SRW_diagnostic **d, int *num, int code, const char *addinfo); -YAZ_EXPORT void yaz_mk_std_diagnostic(ODR o, Z_SRW_diagnostic *d, +YAZ_EXPORT void yaz_mk_std_diagnostic(ODR o, Z_SRW_diagnostic *d, int code, const char *details); YAZ_EXPORT void yaz_add_srw_diagnostic_uri(ODR o, Z_SRW_diagnostic **d, @@ -287,7 +292,7 @@ YAZ_EXPORT void yaz_add_srw_diagnostic_uri(ODR o, Z_SRW_diagnostic **d, const char *message, const char *details); -YAZ_EXPORT void yaz_mk_srw_diagnostic(ODR o, Z_SRW_diagnostic *d, +YAZ_EXPORT void yaz_mk_srw_diagnostic(ODR o, Z_SRW_diagnostic *d, const char *uri, const char *message, const char *details); @@ -298,6 +303,17 @@ YAZ_EXPORT int yaz_sru_post_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, YAZ_EXPORT int yaz_sru_soap_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, ODR odr, const char *charset); +/** \brief encode SOLR request (HTTP) + \param hreq HTTP request to be modified (with encoded request) + \param srw_pdu SRW request + \param encode ODR for result + \param charset character set for request (may be NULL) + \retval -1 fail + \retval 0 OK +*/ +YAZ_EXPORT int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, + ODR encode, const char *charset); + YAZ_EXPORT char *yaz_negotiate_sru_version(char *input_ver); YAZ_EXPORT @@ -308,6 +324,8 @@ void yaz_encode_sru_extra(Z_SRW_PDU *sr, ODR odr, const char *extra_args); #define YAZ_XMLNS_SRU_v1_1 "http://www.loc.gov/zing/srw/" #define YAZ_XMLNS_DIAG_v1_1 "http://www.loc.gov/zing/srw/diagnostic/" #define YAZ_XMLNS_UPDATE_v0_9 "http://www.loc.gov/zing/srw/update/" +#define YAZ_XMLNS_SRU_v2_response "http://docs.oasis-open.org/ns/search-ws/sru*esponse" +#define YAZ_XMLNS_SRU_v1_response "http://www.loc.gov/*" YAZ_EXPORT int yaz_srw_check_content_type(Z_HTTP_Response *hres); @@ -332,7 +350,7 @@ char *yaz_encode_sru_dbpath_odr(ODR out, const char *db); /** \brief encode SRU database for HTTP path \param dst destination buffer (should be at least strlen(db) +2 in size) \param db source database - + The resulting database (dst) includes a leading / */ YAZ_EXPORT