X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fyaz%2Fzoom.h;h=e46070486380d539afcce1eaf8ea4e8978b82d17;hp=e577d35add303b7bc9e5d58c5a8e012540884941;hb=32790840d73b1f4a4bde1478e6b14699aac00e94;hpb=bd3fc10785d649f854929dfab90d8a002d55572c diff --git a/include/yaz/zoom.h b/include/yaz/zoom.h index e577d35..e460704 100644 --- a/include/yaz/zoom.h +++ b/include/yaz/zoom.h @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2009 Index Data. + * Copyright (C) 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: @@ -52,6 +52,7 @@ typedef struct ZOOM_query_p *ZOOM_query; typedef struct ZOOM_connection_p *ZOOM_connection; typedef struct ZOOM_resultset_p *ZOOM_resultset; typedef struct ZOOM_record_p *ZOOM_record; +typedef struct ZOOM_facet_field_p *ZOOM_facet_field; typedef struct ZOOM_scanset_p *ZOOM_scanset; typedef struct ZOOM_package_p *ZOOM_package; @@ -74,6 +75,9 @@ ZOOM_API(void) ZOOM_connection_connect(ZOOM_connection c, const char *host, int portnum); +ZOOM_API(void) +ZOOM_connection_close(ZOOM_connection c); + /* destroy connection (close connection also) */ ZOOM_API(void) ZOOM_connection_destroy(ZOOM_connection c); @@ -136,6 +140,10 @@ ZOOM_diag_str (int error); #define ZOOM_ERROR_CQL_TRANSFORM 10012 #define ZOOM_ERROR_CCL_CONFIG 10013 #define ZOOM_ERROR_CCL_PARSE 10014 +#define ZOOM_ERROR_ES_INVALID_ACTION 10015 +#define ZOOM_ERROR_ES_INVALID_VERSION 10016 +#define ZOOM_ERROR_ES_INVALID_SYNTAX 10017 +#define ZOOM_ERROR_MEMCACHED 10018 ZOOM_API(int) ZOOM_connection_last_event(ZOOM_connection cs); @@ -167,6 +175,14 @@ ZOOM_connection_search_pqf(ZOOM_connection c, const char *q); ZOOM_API(void) ZOOM_resultset_destroy(ZOOM_resultset r); +/** release result set from connection. + + The result will will no longer be able to perform retrievals + from the connection from which it was created. +*/ +ZOOM_API(void) +ZOOM_resultset_release(ZOOM_resultset r); + /* result set option */ ZOOM_API(const char *) ZOOM_resultset_option_get(ZOOM_resultset r, const char *key); @@ -194,6 +210,29 @@ ZOOM_resultset_record_immediate(ZOOM_resultset s, size_t pos); ZOOM_API(void) ZOOM_resultset_cache_reset(ZOOM_resultset r); + +/* retrieve facet field */ +ZOOM_API(ZOOM_facet_field) +ZOOM_resultset_get_facet_field(ZOOM_resultset r, const char *facet_name); + +/* retrieve facet field at position. Returns 0 if unavailable */ +ZOOM_API(ZOOM_facet_field) +ZOOM_resultset_get_facet_field_by_index(ZOOM_resultset r, int pos); + +/* return number of facets available */ +ZOOM_API(size_t) +ZOOM_resultset_facets_size(ZOOM_resultset r); + +/* retrieve (array of pointers to) facet fields */ +ZOOM_API(ZOOM_facet_field *) +ZOOM_resultset_facets(ZOOM_resultset r); + +/* retrieve (array of pointers to) facet fields */ +ZOOM_API(const char **) +ZOOM_resultset_facets_names(ZOOM_resultset r); + + + /* ----------------------------------------------------------- */ /* records */ @@ -213,8 +252,25 @@ ZOOM_record_clone(ZOOM_record srec); ZOOM_API(int) ZOOM_record_error(ZOOM_record rec, const char **msg, const char **addinfo, const char **diagset); - + +/* ----------------------------------------------------------- */ +/* facets */ + +/* get facet name */ +ZOOM_API(const char *) +ZOOM_facet_field_name(ZOOM_facet_field facet_field); + +/* get terms count on facet */ +ZOOM_API(size_t) +ZOOM_facet_field_term_count(ZOOM_facet_field facet_field); + +/* get facet information, term and frequency, at a position. Returns 0 if out of bounds */ +ZOOM_API(const char *) +ZOOM_facet_field_get_term(ZOOM_facet_field facet_field, size_t idx, int *freq); + /* ----------------------------------------------------------- */ + + /* queries */ /* create search object */ @@ -232,7 +288,7 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn); /* CCL translated client-side into RPN: `conn' is optional for diagnostics */ ZOOM_API(int) ZOOM_query_ccl2rpn(ZOOM_query s, const char *query_str, - const char *config, + const char *config, int *ccl_error, const char **error_string, int *error_pos); /* PQF */ ZOOM_API(int) @@ -240,6 +296,11 @@ ZOOM_query_prefix(ZOOM_query s, const char *str); /* specify sort criteria for search */ ZOOM_API(int) ZOOM_query_sortby(ZOOM_query s, const char *criteria); +ZOOM_API(int) +ZOOM_query_sortby2(ZOOM_query s, const char *strategy, const char *criteria); + +ZOOM_API(void) +ZOOM_query_addref(ZOOM_query s); /* ----------------------------------------------------------- */ /* scan */ @@ -251,11 +312,11 @@ ZOOM_connection_scan1(ZOOM_connection c, ZOOM_query startterm); ZOOM_API(const char *) ZOOM_scanset_term(ZOOM_scanset scan, size_t pos, - int *occ, int *len); + size_t *occ, size_t *len); ZOOM_API(const char *) ZOOM_scanset_display_term(ZOOM_scanset scan, size_t pos, - int *occ, int *len); + size_t *occ, size_t *len); ZOOM_API(size_t) ZOOM_scanset_size(ZOOM_scanset scan); @@ -331,7 +392,7 @@ ZOOM_options_getl(ZOOM_options opt, const char *name, int *lenp); ZOOM_API(void) ZOOM_options_set(ZOOM_options opt, const char *name, const char *v); - + ZOOM_API(void) ZOOM_options_setl(ZOOM_options opt, const char *name, const char *value, int len); @@ -360,7 +421,7 @@ ZOOM_options_set_int(ZOOM_options opt, const char *name, int value); \param cs connection array \retval 0 no event was fired \retval >0 event was fired for connection at (retval-1) - + blocking poll for events on a number of connections. Returns positive integer if event occurred ; zero if none occurred and no more events are pending. The positive integer specifies the @@ -401,7 +462,7 @@ ZOOM_event_nonblock(int no, ZOOM_connection *cs); \retval 0 no event was processed \retval 1 event was processed for connection - This function attemps to deal with outstandings events in + This function attemps to deal with outstandings events in a non-blocking fashion. If no event was processed (return value of 0), then the system should attempt to deal with sockets in blocking mode using socket select/poll which means calling the following functions: @@ -413,6 +474,20 @@ ZOOM_API(int) ZOOM_connection_process(ZOOM_connection c); +/** \brief executes non-blocking tasks for connection + \param c connection + \retval 0 no task was executed + \retval 1 task was executed (but probably not completed) + + This function, unlike, ZOOM_connection_process, does not try to + return any events (and remove them). But events may be generated + from it. These are saved and may later be retrieved with + ZOOM_connection_process and ZOOM_connection_last_event . +*/ +ZOOM_API(int) +ZOOM_connection_exec_task(ZOOM_connection c); + + /** \brief get socket fd for ZOOM connection \param c connection \retval -1 no socket assigned for connection @@ -425,7 +500,7 @@ ZOOM_API(int) ZOOM_connection_get_socket(ZOOM_connection c); -/** \brief get socket mask for connection +/** \brief get socket mask for connection \param c connection \returns mask for connection (possibly 0) @@ -474,7 +549,6 @@ ZOOM_API(int) ZOOM_connection_fire_event_socket(ZOOM_connection c, int mask); - /** \brief peek at next event \param c connection \returns ZOOM_EVENT_NONE (for no events in queue), ZOOM_EVENT_CONNECT, .. @@ -489,6 +563,15 @@ ZOOM_connection_peek_event(ZOOM_connection c); ZOOM_API(const char *) ZOOM_get_event_str(int event); +#ifdef WRBUF_H + +/** \brief log APDUs to WRBUF + \param c connection + \param w WRBUF where APDUs are logged +*/ +ZOOM_API(void) ZOOM_connection_save_apdu_wrbuf(ZOOM_connection c, WRBUF w); +#endif + ZOOM_END_CDECL /*