From: Adam Dickmeiss Date: Sat, 13 Jun 1998 00:14:08 +0000 (+0000) Subject: Minor changes. X-Git-Tag: ZEBRA.1.0~197 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=3f45c68ea8b1d3a3e9c5b3a014b3d001e89c46eb Minor changes. --- diff --git a/index/zebraapi.c b/index/zebraapi.c index 5907725..7caf21a 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zebraapi.c,v $ - * Revision 1.4 1998-06-12 12:22:12 adam + * Revision 1.5 1998-06-13 00:14:08 adam + * Minor changes. + * + * Revision 1.4 1998/06/12 12:22:12 adam * Work on Zebra API. * * Revision 1.3 1998/05/27 16:57:44 adam @@ -148,6 +151,8 @@ ZebraHandle zebra_open (const char *configName) zh->records = NULL; zh->zebra_maps = zebra_maps_open (zh->res); zh->rank_classes = NULL; + zh->errCode = 0; + zh->errString = 0; zebraRankInstall (zh, rank1_class); return zh; @@ -199,6 +204,7 @@ void zebra_records_retrieve (ZebraHandle zh, ODR stream, int i, *pos_array; zh->errCode = 0; + zh->errString = NULL; pos_array = xmalloc (num_recs * sizeof(*pos_array)); for (i = 0; ierrCode = 0; + zh->errString = NULL; zebra_register_lock (zh); rpn_scan (zh, stream, zapt, attributeset, num_bases, basenames, position, @@ -256,6 +263,8 @@ void zebra_sort (ZebraHandle zh, ODR stream, char *output_setname, Z_SortKeySpecList *sort_sequence, int *sort_status) { + zh->errCode = 0; + zh->errString = NULL; zebra_register_lock (zh); resultSetSort (zh, stream, num_input_setnames, input_setnames, output_setname, sort_sequence, sort_status); diff --git a/index/zebraapi.h b/index/zebraapi.h index a94d576..83df424 100644 --- a/index/zebraapi.h +++ b/index/zebraapi.h @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zebraapi.h,v $ - * Revision 1.1 1998-06-12 12:22:13 adam + * Revision 1.2 1998-06-13 00:14:09 adam + * Minor changes. + * + * Revision 1.1 1998/06/12 12:22:13 adam * Work on Zebra API. * */ @@ -13,34 +16,40 @@ #include #include +/* Retrieval Record Descriptor */ typedef struct { - int errCode; - char *errString; - int position; - char *buf; - int len; - oid_value format; - char *base; + int errCode; /* non-zero if error when fetching this */ + char *errString; /* error string */ + int position; /* position of record in result set (1,2,..) */ + char *buf; /* record buffer (void pointer really) */ + int len; /* length */ + oid_value format; /* record syntax */ + char *base; } ZebraRetrievalRecord; +/* Scan Term Descriptor */ typedef struct { - int occurrences; - char *term; + int occurrences; /* scan term occurrences */ + char *term; /* scan term string */ } ZebraScanEntry; typedef struct zebra_info *ZebraHandle; -YAZ_EXPORT ZebraHandle zebra_open (const char *host); +/* Open Zebra using file 'configName' (usually zebra.cfg) */ +YAZ_EXPORT ZebraHandle zebra_open (const char *configName); +/* Search using RPN-Query */ YAZ_EXPORT void zebra_search_rpn (ZebraHandle zh, ODR stream, - Z_RPNQuery *query, int num_bases, char **basenames, + Z_RPNQuery *query, int num_bases, char **basenames, const char *setname); +/* Retrieve record(s) */ YAZ_EXPORT void zebra_records_retrieve (ZebraHandle zh, ODR stream, - const char *setname, Z_RecordComposition *comp, - oid_value input_format, - int num_recs, ZebraRetrievalRecord *recs); + const char *setname, Z_RecordComposition *comp, + oid_value input_format, + int num_recs, ZebraRetrievalRecord *recs); +/* Browse */ YAZ_EXPORT void zebra_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, oid_value attributeset, @@ -49,12 +58,17 @@ YAZ_EXPORT void zebra_scan (ZebraHandle zh, ODR stream, ZebraScanEntry **list, int *is_partial); +/* Close zebra and destroy handle */ YAZ_EXPORT void zebra_close (ZebraHandle zh); +/* last error code */ YAZ_EXPORT int zebra_errCode (ZebraHandle zh); +/* string representatio of above */ YAZ_EXPORT const char *zebra_errString (ZebraHandle zh); -YAZ_EXPORT char *zebra_errAdd (ZebraHandle zh); -YAZ_EXPORT int zebra_hits (ZebraHandle zh); +/* extra information associated with error */ +YAZ_EXPORT char *zebra_errAdd (ZebraHandle zh); +/* number of hits (after search) */ +YAZ_EXPORT int zebra_hits (ZebraHandle zh);