Minor.
[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.6  1999-02-17 11:29:57  adam
8  * Fixed in record_fetch. Minor updates to API.
9  *
10  * Revision 1.5  1998/09/22 10:48:19  adam
11  * Minor changes in search API.
12  *
13  * Revision 1.4  1998/09/02 13:53:18  adam
14  * Extra parameter decode added to search routines to implement
15  * persistent queries.
16  *
17  * Revision 1.3  1998/06/22 11:36:48  adam
18  * Added authentication check facility to zebra.
19  *
20  * Revision 1.2  1998/06/13 00:14:09  adam
21  * Minor changes.
22  *
23  * Revision 1.1  1998/06/12 12:22:13  adam
24  * Work on Zebra API.
25  *
26  */
27
28 #include <odr.h>
29 #include <oid.h>
30 #include <proto.h>
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /* Retrieval Record Descriptor */
37 typedef struct {
38     int errCode;         /* non-zero if error when fetching this */
39     char *errString;     /* error string */
40     int position;        /* position of record in result set (1,2,..) */
41     char *buf;           /* record buffer (void pointer really) */
42     int len;             /* length */
43     oid_value format;    /* record syntax */
44     char *base; 
45 } ZebraRetrievalRecord;
46
47 /* Scan Term Descriptor */
48 typedef struct {
49     int occurrences;     /* scan term occurrences */
50     char *term;          /* scan term string */
51 } ZebraScanEntry;
52
53 typedef struct zebra_info *ZebraHandle;
54
55 /* Open Zebra using file 'configName' (usually zebra.cfg) */
56 YAZ_EXPORT ZebraHandle zebra_open (const char *configName);
57
58 /* Search using RPN-Query */
59 YAZ_EXPORT void zebra_search_rpn (ZebraHandle zh, ODR input, ODR output,
60                        Z_RPNQuery *query, int num_bases, char **basenames, 
61                        const char *setname);
62
63 /* Retrieve record(s) */
64 YAZ_EXPORT void zebra_records_retrieve (ZebraHandle zh, ODR stream,
65                        const char *setname, Z_RecordComposition *comp,
66                        oid_value input_format,
67                        int num_recs, ZebraRetrievalRecord *recs);
68
69 /* Browse */
70 YAZ_EXPORT void zebra_scan (ZebraHandle zh, ODR stream,
71                             Z_AttributesPlusTerm *zapt,
72                             oid_value attributeset,
73                             int num_bases, char **basenames,
74                             int *position, int *num_entries,
75                             ZebraScanEntry **list,
76                             int *is_partial);
77
78 /* Close zebra and destroy handle */
79 YAZ_EXPORT void zebra_close (ZebraHandle zh);
80
81 /* last error code */
82 YAZ_EXPORT int zebra_errCode (ZebraHandle zh);
83 /* string representatio of above */
84 YAZ_EXPORT const char *zebra_errString (ZebraHandle zh);
85
86 /* extra information associated with error */
87 YAZ_EXPORT char *zebra_errAdd (ZebraHandle zh);
88
89 /* number of hits (after search) */
90 YAZ_EXPORT int zebra_hits (ZebraHandle zh);
91
92 /* do authentication */
93 YAZ_EXPORT int zebra_auth (ZebraHandle zh, const char *user, const char *pass);
94
95 #ifdef __cplusplus
96 }
97 #endif