Minor changes.
[idzebra-moved-to-github.git] / index / zebraapi.h
1 /*
2  * Copyright (C) 1994-1998, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: zebraapi.h,v $
7  * Revision 1.2  1998-06-13 00:14:09  adam
8  * Minor changes.
9  *
10  * Revision 1.1  1998/06/12 12:22:13  adam
11  * Work on Zebra API.
12  *
13  */
14
15 #include <odr.h>
16 #include <oid.h>
17 #include <proto.h>
18
19 /* Retrieval Record Descriptor */
20 typedef struct {
21     int errCode;         /* non-zero if error when fetching this */
22     char *errString;     /* error string */
23     int position;        /* position of record in result set (1,2,..) */
24     char *buf;           /* record buffer (void pointer really) */
25     int len;             /* length */
26     oid_value format;    /* record syntax */
27     char *base; 
28 } ZebraRetrievalRecord;
29
30 /* Scan Term Descriptor */
31 typedef struct {
32     int occurrences;     /* scan term occurrences */
33     char *term;          /* scan term string */
34 } ZebraScanEntry;
35
36 typedef struct zebra_info *ZebraHandle;
37
38 /* Open Zebra using file 'configName' (usually zebra.cfg) */
39 YAZ_EXPORT ZebraHandle zebra_open (const char *configName);
40
41 /* Search using RPN-Query */
42 YAZ_EXPORT void zebra_search_rpn (ZebraHandle zh, ODR stream,
43                        Z_RPNQuery *query, int num_bases, char **basenames, 
44                        const char *setname);
45
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);
51
52 /* Browse */
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,
59                             int *is_partial);
60
61 /* Close zebra and destroy handle */
62 YAZ_EXPORT void zebra_close (ZebraHandle zh);
63
64 /* last error code */
65 YAZ_EXPORT int zebra_errCode (ZebraHandle zh);
66 /* string representatio of above */
67 YAZ_EXPORT const char *zebra_errString (ZebraHandle zh);
68
69 /* extra information associated with error */
70 YAZ_EXPORT char *zebra_errAdd (ZebraHandle zh);
71
72 /* number of hits (after search) */
73 YAZ_EXPORT int zebra_hits (ZebraHandle zh);
74