2 * Copyright (C) 1994-2002, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: zebraapi.h,v 1.13 2002-02-20 17:30:01 adam Exp $
14 #include <yaz/proto.h>
18 /* Retrieval Record Descriptor */
20 int errCode; /* non-zero if error when fetching this */
21 char *errString; /* error string */
22 int position; /* position of record in result set (1,2,..) */
23 char *buf; /* record buffer (void pointer really) */
25 oid_value format; /* record syntax */
27 } ZebraRetrievalRecord;
29 /* Scan Term Descriptor */
31 int occurrences; /* scan term occurrences */
32 char *term; /* scan term string */
35 typedef struct zebra_session *ZebraHandle;
36 typedef struct zebra_service *ZebraService;
38 /* Open Zebra using file 'configName' (usually zebra.cfg) */
39 YAZ_EXPORT ZebraHandle zebra_open (ZebraService zs);
41 /* Search using RPN-Query */
42 YAZ_EXPORT void zebra_search_rpn (ZebraHandle zh, ODR input, ODR output,
43 Z_RPNQuery *query, int num_bases, char **basenames,
46 /* Retrieve record(s) */
47 YAZ_EXPORT void zebra_records_retrieve (ZebraHandle zh, ODR stream,
48 const char *setname, Z_RecordComposition *comp,
49 oid_value input_format,
50 int num_recs, ZebraRetrievalRecord *recs);
53 YAZ_EXPORT void zebra_scan (ZebraHandle zh, ODR stream,
54 Z_AttributesPlusTerm *zapt,
55 oid_value attributeset,
56 int num_bases, char **basenames,
57 int *position, int *num_entries,
58 ZebraScanEntry **list,
61 /* Delete Result Set(s) */
62 YAZ_EXPORT int zebra_deleleResultSet(ZebraHandle zh, int function,
63 int num_setnames, char **setnames,
66 /* Close zebra and destroy handle */
67 YAZ_EXPORT void zebra_close (ZebraHandle zh);
70 YAZ_EXPORT int zebra_errCode (ZebraHandle zh);
71 /* string representatio of above */
72 YAZ_EXPORT const char *zebra_errString (ZebraHandle zh);
74 /* extra information associated with error */
75 YAZ_EXPORT char *zebra_errAdd (ZebraHandle zh);
77 /* number of hits (after search) */
78 YAZ_EXPORT int zebra_hits (ZebraHandle zh);
80 /* do authentication */
81 YAZ_EXPORT int zebra_auth (ZebraService zh, const char *user, const char *pass);
83 /* Character normalisation on specific register .
84 This routine is subject to change - do not use. */
85 YAZ_EXPORT int zebra_string_norm (ZebraHandle zh, unsigned reg_id,
86 const char *input_str, int input_len,
87 char *output_str, int output_len);
89 YAZ_EXPORT void zebra_admin_create (ZebraHandle zh, const char *db);
91 YAZ_EXPORT ZebraService zebra_start (const char *configName);
92 YAZ_EXPORT void zebra_stop (ZebraService zs);
94 YAZ_EXPORT void zebra_admin_shutdown (ZebraHandle zh);
95 YAZ_EXPORT void zebra_admin_start (ZebraHandle zh);
97 YAZ_EXPORT void zebra_shutdown (ZebraService zs);
99 YAZ_EXPORT void zebra_admin_import_begin (ZebraHandle zh, const char *database);
101 YAZ_EXPORT void zebra_admin_import_segment (ZebraHandle zh,
104 void zebra_admin_import_end (ZebraHandle zh);
106 void zebra_begin_trans (ZebraHandle zh);
107 void zebra_end_trans (ZebraHandle zh);
109 void zebra_commit (ZebraHandle zh);
111 void zebra_init (ZebraHandle zh);
112 void zebra_compact (ZebraHandle zh);
113 void zebra_repository_update (ZebraHandle zh);
114 void zebra_repository_delete (ZebraHandle zh);
115 void zebra_repository_show (ZebraHandle zh);
116 int zebra_record_insert (ZebraHandle zh, const char *buf, int len);