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