Added zebra_string_norm.
[idzebra-moved-to-github.git] / index / zebraapi.h
1 /*
2  * Copyright (C) 1994-1998, Index Data
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: zebraapi.h,v $
7  * Revision 1.9  2000-02-24 12:31:17  adam
8  * Added zebra_string_norm.
9  *
10  * Revision 1.8  1999/11/30 13:48:03  adam
11  * Improved installation. Updated for inclusion of YAZ header files.
12  *
13  * Revision 1.7  1999/11/04 15:00:45  adam
14  * Implemented delete result set(s).
15  *
16  * Revision 1.6  1999/02/17 11:29:57  adam
17  * Fixed in record_fetch. Minor updates to API.
18  *
19  * Revision 1.5  1998/09/22 10:48:19  adam
20  * Minor changes in search API.
21  *
22  * Revision 1.4  1998/09/02 13:53:18  adam
23  * Extra parameter decode added to search routines to implement
24  * persistent queries.
25  *
26  * Revision 1.3  1998/06/22 11:36:48  adam
27  * Added authentication check facility to zebra.
28  *
29  * Revision 1.2  1998/06/13 00:14:09  adam
30  * Minor changes.
31  *
32  * Revision 1.1  1998/06/12 12:22:13  adam
33  * Work on Zebra API.
34  *
35  */
36
37 #include <yaz/odr.h>
38 #include <yaz/oid.h>
39 #include <yaz/proto.h>
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /* Retrieval Record Descriptor */
46 typedef struct {
47     int errCode;         /* non-zero if error when fetching this */
48     char *errString;     /* error string */
49     int position;        /* position of record in result set (1,2,..) */
50     char *buf;           /* record buffer (void pointer really) */
51     int len;             /* length */
52     oid_value format;    /* record syntax */
53     char *base; 
54 } ZebraRetrievalRecord;
55
56 /* Scan Term Descriptor */
57 typedef struct {
58     int occurrences;     /* scan term occurrences */
59     char *term;          /* scan term string */
60 } ZebraScanEntry;
61
62 typedef struct zebra_info *ZebraHandle;
63
64 /* Open Zebra using file 'configName' (usually zebra.cfg) */
65 YAZ_EXPORT ZebraHandle zebra_open (const char *configName);
66
67 /* Search using RPN-Query */
68 YAZ_EXPORT void zebra_search_rpn (ZebraHandle zh, ODR input, ODR output,
69                        Z_RPNQuery *query, int num_bases, char **basenames, 
70                        const char *setname);
71
72 /* Retrieve record(s) */
73 YAZ_EXPORT void zebra_records_retrieve (ZebraHandle zh, ODR stream,
74                        const char *setname, Z_RecordComposition *comp,
75                        oid_value input_format,
76                        int num_recs, ZebraRetrievalRecord *recs);
77
78 /* Browse */
79 YAZ_EXPORT void zebra_scan (ZebraHandle zh, ODR stream,
80                             Z_AttributesPlusTerm *zapt,
81                             oid_value attributeset,
82                             int num_bases, char **basenames,
83                             int *position, int *num_entries,
84                             ZebraScanEntry **list,
85                             int *is_partial);
86     
87 /* Delete Result Set(s) */
88 YAZ_EXPORT int zebra_deleleResultSet(ZebraHandle zh, int function,
89                                      int num_setnames, char **setnames,
90                                      int *statuses);
91
92 /* Close zebra and destroy handle */
93 YAZ_EXPORT void zebra_close (ZebraHandle zh);
94
95 /* last error code */
96 YAZ_EXPORT int zebra_errCode (ZebraHandle zh);
97 /* string representatio of above */
98 YAZ_EXPORT const char *zebra_errString (ZebraHandle zh);
99
100 /* extra information associated with error */
101 YAZ_EXPORT char *zebra_errAdd (ZebraHandle zh);
102
103 /* number of hits (after search) */
104 YAZ_EXPORT int zebra_hits (ZebraHandle zh);
105
106 /* do authentication */
107 YAZ_EXPORT int zebra_auth (ZebraHandle zh, const char *user, const char *pass);
108
109 /* Character normalisation on specific register .
110    This routine is subject to change - do not use. */
111 YAZ_EXPORT int zebra_string_norm (ZebraHandle zh, unsigned reg_id,
112                                   const char *input_str, int input_len,
113                                   char *output_str, int output_len);
114                                       
115 #ifdef __cplusplus
116 }
117 #endif